Mercurial > vim
comparison src/window.c @ 30339:b5f67135fcb6 v9.0.0505
patch 9.0.0505: various problems with 'nosplitscroll'
Commit: https://github.com/vim/vim/commit/faf1d412f5e3665021500b528c0e7301eb02bf0b
Author: Luuk van Baal <luukvbaal@gmail.com>
Date: Mon Sep 19 16:45:29 2022 +0100
patch 9.0.0505: various problems with 'nosplitscroll'
Problem: Various problems with 'nosplitscroll'.
Solution: Fix 'nosplitscroll' problems. (Luuk van Baal, closes https://github.com/vim/vim/issues/11166)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Sep 2022 18:00:05 +0200 |
parents | b9d07900b0b8 |
children | 69ff2bd737a9 |
comparison
equal
deleted
inserted
replaced
30338:25e5ee65b53a | 30339:b5f67135fcb6 |
---|---|
4476 CHECK_CMDWIN; | 4476 CHECK_CMDWIN; |
4477 | 4477 |
4478 // Don't repeat a message in another tab page. | 4478 // Don't repeat a message in another tab page. |
4479 set_keep_msg(NULL, 0); | 4479 set_keep_msg(NULL, 0); |
4480 | 4480 |
4481 skip_win_fix_scroll = TRUE; | |
4481 if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer, | 4482 if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer, |
4482 trigger_leave_autocmds) == OK) | 4483 trigger_leave_autocmds) == OK) |
4483 { | 4484 { |
4484 if (valid_tabpage(tp)) | 4485 if (valid_tabpage(tp)) |
4485 enter_tabpage(tp, curbuf, trigger_enter_autocmds, | 4486 enter_tabpage(tp, curbuf, trigger_enter_autocmds, |
4486 trigger_leave_autocmds); | 4487 trigger_leave_autocmds); |
4487 else | 4488 else |
4488 enter_tabpage(curtab, curbuf, trigger_enter_autocmds, | 4489 enter_tabpage(curtab, curbuf, trigger_enter_autocmds, |
4489 trigger_leave_autocmds); | 4490 trigger_leave_autocmds); |
4490 } | 4491 } |
4492 skip_win_fix_scroll = FALSE; | |
4491 } | 4493 } |
4492 | 4494 |
4493 /* | 4495 /* |
4494 * Go to the last accessed tab page, if there is one. | 4496 * Go to the last accessed tab page, if there is one. |
4495 * Return OK or FAIL | 4497 * Return OK or FAIL |
5479 | 5481 |
5480 (void)win_comp_pos(); // recompute w_winrow and w_wincol | 5482 (void)win_comp_pos(); // recompute w_winrow and w_wincol |
5481 compute_cmdrow(); | 5483 compute_cmdrow(); |
5482 curtab->tp_ch_used = p_ch; | 5484 curtab->tp_ch_used = p_ch; |
5483 | 5485 |
5484 if (!p_spsc) | 5486 if (!p_spsc && !skip_win_fix_scroll) |
5485 win_fix_scroll(TRUE); | 5487 win_fix_scroll(TRUE); |
5486 | 5488 |
5487 #if 0 | 5489 #if 0 |
5488 // Disabled: don't want making the screen smaller make a window larger. | 5490 // Disabled: don't want making the screen smaller make a window larger. |
5489 if (p_ea) | 5491 if (p_ea) |
6360 win_fix_scroll(int resize) | 6362 win_fix_scroll(int resize) |
6361 { | 6363 { |
6362 win_T *wp; | 6364 win_T *wp; |
6363 linenr_T lnum; | 6365 linenr_T lnum; |
6364 | 6366 |
6367 skip_update_topline = TRUE; // avoid scrolling in curs_rows() | |
6365 FOR_ALL_WINDOWS(wp) | 6368 FOR_ALL_WINDOWS(wp) |
6366 { | 6369 { |
6367 // Skip when window height has not changed or when | 6370 // Skip when window height has not changed. |
6368 // buffer has less lines than the window height. | |
6369 if (wp->w_height != wp->w_prev_height) | 6371 if (wp->w_height != wp->w_prev_height) |
6370 { | 6372 { |
6371 // Determine botline needed to avoid scrolling and set cursor. | 6373 // Determine botline needed to avoid scrolling and set cursor. |
6372 if (wp->w_winrow != wp->w_prev_winrow) | 6374 if (wp->w_winrow != wp->w_prev_winrow) |
6373 { | 6375 { |
6385 } | 6387 } |
6386 win_comp_scroll(wp); | 6388 win_comp_scroll(wp); |
6387 wp->w_prev_height = wp->w_height; | 6389 wp->w_prev_height = wp->w_height; |
6388 wp->w_prev_winrow = wp->w_winrow; | 6390 wp->w_prev_winrow = wp->w_winrow; |
6389 } | 6391 } |
6392 skip_update_topline = FALSE; | |
6390 // Ensure cursor is valid when not in normal mode or when resized. | 6393 // Ensure cursor is valid when not in normal mode or when resized. |
6391 if (!(get_real_state() & (MODE_NORMAL|MODE_CMDLINE))) | 6394 if (!(get_real_state() & (MODE_NORMAL|MODE_CMDLINE|MODE_TERMINAL))) |
6392 win_fix_cursor(FALSE); | 6395 win_fix_cursor(FALSE); |
6393 else if (resize) | 6396 else if (resize) |
6394 win_fix_cursor(TRUE); | 6397 win_fix_cursor(TRUE); |
6395 } | 6398 } |
6396 | 6399 |
6433 curs_columns(TRUE); // validate w_wrow | 6436 curs_columns(TRUE); // validate w_wrow |
6434 } | 6437 } |
6435 else | 6438 else |
6436 { // Ensure cursor stays visible if we are not in normal mode. | 6439 { // Ensure cursor stays visible if we are not in normal mode. |
6437 wp->w_fraction = 0.5 * FRACTION_MULT; | 6440 wp->w_fraction = 0.5 * FRACTION_MULT; |
6438 // Make sure cursor is closer to topline than botline. | |
6439 if (so == wp->w_height / 2 | |
6440 && nlnum - wp->w_topline > wp->w_botline - 1 - nlnum) | |
6441 wp->w_fraction++; | |
6442 scroll_to_fraction(wp, wp->w_prev_height); | 6441 scroll_to_fraction(wp, wp->w_prev_height); |
6442 validate_botline_win(curwin); | |
6443 } | 6443 } |
6444 } | 6444 } |
6445 } | 6445 } |
6446 | 6446 |
6447 /* | 6447 /* |