To: vim_dev@googlegroups.com Subject: Patch 9.0.0455 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0455 Problem: A few problems with 'splitscroll'. Solution: Fix 'splitscroll' problems. (Luuk van Baal, closes #11117) Files: src/main.c, src/menu.c, src/window.c, src/testdir/test_window_cmd.vim *** ../vim-9.0.0454/src/main.c 2022-09-06 18:31:09.070310282 +0100 --- src/main.c 2022-09-13 11:49:16.670776270 +0100 *************** *** 375,381 **** * Set the default values for the options that use Rows and Columns. */ ui_get_shellsize(); // inits Rows and Columns - win_init_size(); #ifdef FEAT_DIFF // Set the 'diff' option now, so that it can be checked for in a .vimrc // file. There is no buffer yet though. --- 375,380 ---- *************** *** 542,547 **** --- 541,547 ---- mch_exit(1); } #endif + win_init_size(); #ifdef FEAT_VIMINFO /* *** ../vim-9.0.0454/src/menu.c 2022-09-12 13:35:06.514946763 +0100 --- src/menu.c 2022-09-13 11:49:16.670776270 +0100 *************** *** 436,441 **** --- 436,442 ---- --curwin->w_height; curwin->w_winbar_height = h; } + curwin->w_prev_height = curwin->w_height; } theend: *** ../vim-9.0.0454/src/window.c 2022-09-11 16:59:48.938110035 +0100 --- src/window.c 2022-09-13 11:49:16.674776259 +0100 *************** *** 3923,3928 **** --- 3923,3929 ---- win_init_size(void) { firstwin->w_height = ROWS_AVAIL; + firstwin->w_prev_height = ROWS_AVAIL; topframe->fr_height = ROWS_AVAIL; firstwin->w_width = Columns; topframe->fr_width = Columns; *************** *** 4069,4074 **** --- 4070,4076 ---- win_init_size(); firstwin->w_winrow = tabline_height(); + firstwin->w_prev_winrow = firstwin->w_winrow; win_comp_scroll(curwin); newtp->tp_topframe = topframe; *************** *** 6372,6381 **** { lnum = wp->w_cursor.lnum; wp->w_cursor.lnum = MIN(wp->w_buffer->b_ml.ml_line_count, ! wp->w_botline - 1 + (wp->w_prev_height ! ? (wp->w_winrow - wp->w_prev_winrow) ! + (wp->w_height - wp->w_prev_height) ! : -WINBAR_HEIGHT(wp))); // Bring the new cursor position to the bottom of the screen. wp->w_fraction = FRACTION_MULT; scroll_to_fraction(wp, wp->w_prev_height); --- 6374,6381 ---- { lnum = wp->w_cursor.lnum; wp->w_cursor.lnum = MIN(wp->w_buffer->b_ml.ml_line_count, ! wp->w_botline - 1 + (wp->w_winrow - wp->w_prev_winrow) ! + (wp->w_height - wp->w_prev_height)); // Bring the new cursor position to the bottom of the screen. wp->w_fraction = FRACTION_MULT; scroll_to_fraction(wp, wp->w_prev_height); *************** *** 6802,6807 **** --- 6802,6810 ---- comp_col(); redraw_all_later(UPD_SOME_VALID); } + // Set prev_height when difference is due to 'laststatus'. + if (abs(wp->w_height - wp->w_prev_height) == 1) + wp->w_prev_height = wp->w_height; } else if (fr->fr_layout == FR_ROW) { *************** *** 7091,7096 **** --- 7094,7101 ---- win_comp_pos(); if (wp != NULL && close_curwin) win_goto(wp); + if (!p_spsc) + win_fix_scroll(FALSE); redraw_all_later(UPD_NOT_VALID); } clear_snapshot(curtab, idx); *** ../vim-9.0.0454/src/testdir/test_window_cmd.vim 2022-09-11 16:59:48.938110035 +0100 --- src/testdir/test_window_cmd.vim 2022-09-13 11:49:16.670776270 +0100 *************** *** 1646,1651 **** --- 1646,1652 ---- for so in [0, 5] for ls in range(0, 2) for pos in ["H", "M", "L"] + tabnew | tabonly! | redraw let tabline = (gui ? 0 : (tab ? 1 : 0)) let winbar_sb = (sb ? winbar : 0) execute 'set scrolloff=' . so *************** *** 1655,1671 **** execute tab ? 'tabnew' : '' execute winbar ? 'nnoremenu 1.10 WinBar.Test :echo' : '' call setline(1, range(1, 256)) ! execute 'norm gg' . pos ! " No scroll for vertical split and quit ! vsplit | quit ! call assert_equal(1, line("w0")) ! " No scroll for horizontal split ! split | redraw! | wincmd k call assert_equal(1, line("w0")) " No scroll when resizing windows ! resize +2 call assert_equal(1, line("w0")) wincmd j call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) --- 1656,1678 ---- execute tab ? 'tabnew' : '' execute winbar ? 'nnoremenu 1.10 WinBar.Test :echo' : '' call setline(1, range(1, 256)) ! " No scroll for restore_snapshot ! norm G ! try ! copen | close | colder ! catch /E380/ ! endtry ! call assert_equal(257 - winheight(0), line("w0")) ! " No scroll for firstwin horizontal split ! execute 'norm gg' . pos ! split | redraw | wincmd k call assert_equal(1, line("w0")) + wincmd j + call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) " No scroll when resizing windows ! wincmd k | resize +2 call assert_equal(1, line("w0")) wincmd j call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) *************** *** 1715,1721 **** call assert_equal(1, line("w0")) " No scroll in windows split and quit multiple times ! quit | split | split | quit call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) " No scroll for new buffer --- 1722,1728 ---- call assert_equal(1, line("w0")) " No scroll in windows split and quit multiple times ! quit | redraw | split | redraw | split | redraw | quit | redraw call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) " No scroll for new buffer *************** *** 1740,1750 **** call assert_equal(6, line("w0")) wincmd j call assert_equal(5 + win_screenpos(0)[0] - tabline - winbar_sb, line("w0")) - only endfor endfor endfor - tabonly! endfor endfor endfor --- 1747,1755 ---- *** ../vim-9.0.0454/src/version.c 2022-09-13 11:25:50.510322375 +0100 --- src/version.c 2022-09-13 11:50:40.170553294 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 455, /**/ -- hundred-and-one symptoms of being an internet addict: 54. You start tilting your head sideways to smile. :-) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///