parent
3612eb50e5
commit
7b9d8d39b1
|
@ -647,54 +647,20 @@ HighlighterAndId create_column_highlighter(HighlighterParameters params)
|
|||
}
|
||||
if (not found)
|
||||
{
|
||||
ColumnCount first_buffer_col = -1;
|
||||
ColumnCount first_display_col = 0;
|
||||
ColumnCount last_buffer_col = context.window().position().column;
|
||||
for (auto& atom : line)
|
||||
{
|
||||
if (atom.has_buffer_range())
|
||||
{
|
||||
first_buffer_col = get_column(buffer, tabstop, atom.begin());
|
||||
break;
|
||||
}
|
||||
first_display_col += atom.length();
|
||||
if (atom.has_buffer_range() and atom.begin() != atom.end())
|
||||
last_buffer_col = get_column(buffer, tabstop, atom.end());
|
||||
}
|
||||
|
||||
if (first_buffer_col == -1)
|
||||
continue;
|
||||
|
||||
ColumnCount eol_col = line.length();
|
||||
ColumnCount count = column + first_display_col - first_buffer_col - eol_col;
|
||||
ColumnCount count = column - last_buffer_col;
|
||||
if (count >= 0)
|
||||
{
|
||||
if (count > 0)
|
||||
line.push_back({String{' ', count}});
|
||||
line.push_back({String{" "}, face});
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto atom_it = line.end(); atom_it != line.begin() and count < 0; --atom_it)
|
||||
{
|
||||
DisplayAtom& atom = *(atom_it-1);
|
||||
|
||||
const ColumnCount len = atom.length();
|
||||
if (atom.type() == DisplayAtom::Text and -count <= len)
|
||||
{
|
||||
auto it = atom_it - 1;
|
||||
ColumnCount pos = len + count;
|
||||
if (pos > 0)
|
||||
{
|
||||
it = ++line.split(it, pos);
|
||||
pos = 0;
|
||||
}
|
||||
if (pos+1 != it->length())
|
||||
it = line.split(it, pos+1);
|
||||
|
||||
apply_face(face)(*it);
|
||||
break;
|
||||
}
|
||||
count += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxx
|
||||
xxxx xxxx
|
||||
|
|
@ -0,0 +1 @@
|
|||
gl
|
|
@ -0,0 +1,6 @@
|
|||
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "xxxxxxxxxx" }, { "face": { "fg": "default", "bg": "blue", "attributes": [] }, "contents": "x" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "x" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "xxx\u000a" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "default", "bg": "blue", "attributes": [] }, "contents": " " }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "default", "bg": "blue", "attributes": [] }, "contents": " " }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "default", "bg": "blue", "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:89 " }, { "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": 79 }] }
|
||||
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }
|
|
@ -0,0 +1,4 @@
|
|||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxx xxxx
|
||||
xxxxxxxx
|
||||
|
|
@ -0,0 +1 @@
|
|||
add-highlighter column 20 default,blue
|
Loading…
Reference in New Issue
Block a user