Window: avoid positionning window on a negative column

Fixes #1741
This commit is contained in:
Maxime Coste 2017-12-15 08:17:35 +11:00
parent 43d2e12c0e
commit cafecda230
5 changed files with 11 additions and 1 deletions

View File

@ -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;

View File

@ -0,0 +1 @@

View File

@ -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] }

View File

@ -0,0 +1 @@
01234567890123456789012345678901234567890123456789012345678901234567890123456789

View File

@ -0,0 +1 @@
set global scrolloff 0,20