diff --git a/src/window.cc b/src/window.cc index bf4c1e08..b64d0fae 100644 --- a/src/window.cc +++ b/src/window.cc @@ -204,7 +204,8 @@ DisplaySetup Window::compute_display_setup(const Context& context) // now ensure the cursor column is visible { - auto underflow = setup.cursor_pos.column - setup.scroll_offset.column; + auto underflow = std::max(-setup.window_pos.column, + setup.cursor_pos.column - setup.scroll_offset.column); if (underflow < 0) { setup.window_pos.column += underflow; diff --git a/test/regression/1741-scrolloff-hides-end-of-lines/cmd b/test/regression/1741-scrolloff-hides-end-of-lines/cmd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/1741-scrolloff-hides-end-of-lines/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/1741-scrolloff-hides-end-of-lines/display b/test/regression/1741-scrolloff-hides-end-of-lines/display new file mode 100644 index 00000000..e843b684 --- /dev/null +++ b/test/regression/1741-scrolloff-hides-end-of-lines/display @@ -0,0 +1,6 @@ +{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "0" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "1234567890123456789012345678901234567890123456789012345678901234567890123456789" }]], { "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: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": " - unnamed0@[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] } diff --git a/test/regression/1741-scrolloff-hides-end-of-lines/in b/test/regression/1741-scrolloff-hides-end-of-lines/in new file mode 100644 index 00000000..2a3419ac --- /dev/null +++ b/test/regression/1741-scrolloff-hides-end-of-lines/in @@ -0,0 +1 @@ +01234567890123456789012345678901234567890123456789012345678901234567890123456789 diff --git a/test/regression/1741-scrolloff-hides-end-of-lines/rc b/test/regression/1741-scrolloff-hides-end-of-lines/rc new file mode 100644 index 00000000..4ed761a4 --- /dev/null +++ b/test/regression/1741-scrolloff-hides-end-of-lines/rc @@ -0,0 +1 @@ +set global scrolloff 0,20