Correctly handle tabs when show_whitespaces is added
Tabs now align to tab stops instead of always spanning 8 spaces when show_whitespaces is added as a highlighter. This fixes issue #1453. A regression test is also provided.
This commit is contained in:
parent
a37ccf4238
commit
bd65719698
|
@ -941,7 +941,7 @@ void show_whitespaces(const Context& context, HighlightPass, DisplayBuffer& disp
|
||||||
|
|
||||||
if (cp == '\t')
|
if (cp == '\t')
|
||||||
{
|
{
|
||||||
int column = (int)get_column(buffer, tabstop, it.coord());
|
int column = (int)get_column(buffer, tabstop, (it - 1).coord());
|
||||||
int count = tabstop - (column % tabstop);
|
int count = tabstop - (column % tabstop);
|
||||||
atom_it->replace(tab + String(tabpad[(CharCount)0], CharCount{count-1}));
|
atom_it->replace(tab + String(tabpad[(CharCount)0], CharCount{count-1}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ithis<tab>is<tab>a<tab>test<esc>
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "this" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "is" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "a" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "tes" }, { "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "t" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
|
||||||
|
{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }
|
||||||
|
{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }
|
||||||
|
{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:14 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }
|
||||||
|
{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 27 }] }
|
||||||
|
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }
|
|
@ -0,0 +1 @@
|
||||||
|
add-highlighter show_whitespaces
|
Loading…
Reference in New Issue
Block a user