summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-07-19 22:47:39 +1000
committerMaxime Coste <mawww@kakoune.org>2022-07-19 22:47:39 +1000
commit559af669c77a3b3b6de0376f177ebbba5ebd0328 (patch)
tree1ad3deac73dac47abdfe0a159172481688f6ec51
parent9ebd0cd9c12523e02dae96130454791e48479704 (diff)
Remove out-of-date column computation in show-whitespaces
Now that we compute display buffer on whole lines, it does not make sense to compute the tab padding based off the window column position Fixes #4674
-rw-r--r--src/highlighters.cc4
-rw-r--r--test/regression/4674-show-whitespaces-horizontal-scroll-assert/cmd1
-rw-r--r--test/regression/4674-show-whitespaces-horizontal-scroll-assert/in1
-rw-r--r--test/regression/4674-show-whitespaces-horizontal-scroll-assert/rc2
-rw-r--r--test/regression/4674-show-whitespaces-horizontal-scroll-assert/script2
5 files changed, 7 insertions, 3 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc
index 4b9540b6..39fd28fd 100644
--- a/src/highlighters.cc
+++ b/src/highlighters.cc
@@ -1061,7 +1061,6 @@ private:
const int tabstop = context.context.options()["tabstop"].get<int>();
auto whitespaceface = context.context.faces()["Whitespace"];
const auto& buffer = context.context.buffer();
- auto win_column = context.setup.first_column;
for (auto& line : display_buffer.lines())
{
for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it)
@@ -1085,8 +1084,7 @@ private:
if (cp == '\t')
{
const ColumnCount column = get_column(buffer, tabstop, coord);
- const ColumnCount count = tabstop - (column % tabstop) -
- std::max(win_column - column, 0_col);
+ const ColumnCount count = tabstop - (column % tabstop);
atom_it->replace(m_tab + String(m_tabpad[(CharCount)0], count - m_tab.column_length()));
}
else if (cp == ' ')
diff --git a/test/regression/4674-show-whitespaces-horizontal-scroll-assert/cmd b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/cmd
new file mode 100644
index 00000000..f13d7ddb
--- /dev/null
+++ b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/cmd
@@ -0,0 +1 @@
+gl
diff --git a/test/regression/4674-show-whitespaces-horizontal-scroll-assert/in b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/in
new file mode 100644
index 00000000..21417bda
--- /dev/null
+++ b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/in
@@ -0,0 +1 @@
+ foobar
diff --git a/test/regression/4674-show-whitespaces-horizontal-scroll-assert/rc b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/rc
new file mode 100644
index 00000000..c1f67a84
--- /dev/null
+++ b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/rc
@@ -0,0 +1,2 @@
+add-highlighter window/ show-whitespaces
+add-highlighter window/ number-lines
diff --git a/test/regression/4674-show-whitespaces-horizontal-scroll-assert/script b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/script
new file mode 100644
index 00000000..573e827f
--- /dev/null
+++ b/test/regression/4674-show-whitespaces-horizontal-scroll-assert/script
@@ -0,0 +1,2 @@
+ui_out -ignore 1
+ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " 1│" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": ["final_fg"] }, "contents": " → → → → → → → → " }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "fooba" }, { "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "r" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'