0
0
mirror of https://github.com/vim/vim.git synced 2025-11-16 23:24:03 -05:00

patch 9.1.1238: wrong cursor column with 'set splitkeep=screen'

Problem:  With ':set splitkeep=screen', cursor did't restore column
          correctly when splitting a window on a line longer than the
          last line on the screen (after v9.1.0707)
Solution: Restore cursor column in `win_fix_scroll()` since it may be
          changed in `getvcol()` after 396fd1ec29 (phanium).

Example:
```
echo longlonglongling\nshort | vim - -u NONE --cmd 'set
splitkeep=screen' +'norm $' +new +q
```

fixes: #16968
closes: #16971

Signed-off-by: phanium <91544758+phanen@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
phanium
2025-03-25 20:15:31 +01:00
committed by Christian Brabandt
parent 2726821d38
commit 7746348c5d
3 changed files with 17 additions and 2 deletions

View File

@@ -7038,7 +7038,7 @@ win_fix_scroll(int resize)
{
int diff = (wp->w_winrow - wp->w_prev_winrow)
+ (wp->w_height - wp->w_prev_height);
linenr_T lnum = wp->w_cursor.lnum;
pos_T cursor = wp->w_cursor;
wp->w_cursor.lnum = wp->w_botline - 1;
// Add difference in height and row to botline.
@@ -7052,7 +7052,8 @@ win_fix_scroll(int resize)
wp->w_fraction = FRACTION_MULT;
scroll_to_fraction(wp, wp->w_prev_height);
wp->w_cursor.lnum = lnum;
wp->w_cursor = cursor;
wp->w_valid &= ~VALID_WCOL;
}
else if (wp == curwin)
wp->w_valid &= ~VALID_CROW;