Fix bug in WrapHighlighter::do_compute_display_setup

Additional lines were not pulled correctly when a line was removed
due to its wrapping hiding the cursor.

Fixes #2999
This commit is contained in:
Maxime Coste 2019-08-05 20:16:59 +10:00
parent 6eec6e656d
commit 1c6aa9baed
5 changed files with 22 additions and 2 deletions

View File

@ -811,10 +811,10 @@ struct WrapHighlighter : Highlighter
while (buf_line >= cursor.line and setup.window_pos.line < cursor.line and
setup.cursor_pos.line + setup.scroll_offset.line >= win_height)
{
auto remove_count = std::min(win_height, 1 + line_wrap_count(setup.window_pos.line, indent));
auto remove_count = 1 + line_wrap_count(setup.window_pos.line, indent);
++setup.window_pos.line;
--setup.window_range.line;
setup.cursor_pos.line -= remove_count;
setup.cursor_pos.line -= std::min(win_height, remove_count);
win_line -= remove_count;
kak_assert(setup.cursor_pos.line >= 0);
}

View File

@ -0,0 +1 @@
j

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
add-highlighter global/ wrap -indent -word

View File

@ -0,0 +1,7 @@
{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "l" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "et x = \"rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "rrrrrrrrrrrrrrrrrrrr\"\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "proc translateStr*(toTrans: string, transTable: Table[int, int]): string =\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " for charac in toTrans.runes:\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " if charac.int in transTable:\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " result &= transTable[charac.int].Rune\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " else:\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " result &= charac\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "echo translateStr(x, lowTOUP.toTable)\u000a" }]], { "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 2:1 " }, { "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": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }
{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] }
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }