mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.0455: a few problems with 'splitscroll'
Problem: A few problems with 'splitscroll'. Solution: Fix 'splitscroll' problems. (Luuk van Baal, closes #11117)
This commit is contained in:
committed by
Bram Moolenaar
parent
810cb5a3bf
commit
5ed391708a
@@ -375,7 +375,6 @@ main
|
|||||||
* Set the default values for the options that use Rows and Columns.
|
* Set the default values for the options that use Rows and Columns.
|
||||||
*/
|
*/
|
||||||
ui_get_shellsize(); // inits Rows and Columns
|
ui_get_shellsize(); // inits Rows and Columns
|
||||||
win_init_size();
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
// Set the 'diff' option now, so that it can be checked for in a .vimrc
|
// Set the 'diff' option now, so that it can be checked for in a .vimrc
|
||||||
// file. There is no buffer yet though.
|
// file. There is no buffer yet though.
|
||||||
@@ -542,6 +541,7 @@ vim_main2(void)
|
|||||||
mch_exit(1);
|
mch_exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
win_init_size();
|
||||||
|
|
||||||
#ifdef FEAT_VIMINFO
|
#ifdef FEAT_VIMINFO
|
||||||
/*
|
/*
|
||||||
|
@@ -436,6 +436,7 @@ ex_menu(
|
|||||||
--curwin->w_height;
|
--curwin->w_height;
|
||||||
curwin->w_winbar_height = h;
|
curwin->w_winbar_height = h;
|
||||||
}
|
}
|
||||||
|
curwin->w_prev_height = curwin->w_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
theend:
|
theend:
|
||||||
|
@@ -1646,6 +1646,7 @@ func Test_splitscroll_with_splits()
|
|||||||
for so in [0, 5]
|
for so in [0, 5]
|
||||||
for ls in range(0, 2)
|
for ls in range(0, 2)
|
||||||
for pos in ["H", "M", "L"]
|
for pos in ["H", "M", "L"]
|
||||||
|
tabnew | tabonly! | redraw
|
||||||
let tabline = (gui ? 0 : (tab ? 1 : 0))
|
let tabline = (gui ? 0 : (tab ? 1 : 0))
|
||||||
let winbar_sb = (sb ? winbar : 0)
|
let winbar_sb = (sb ? winbar : 0)
|
||||||
execute 'set scrolloff=' . so
|
execute 'set scrolloff=' . so
|
||||||
@@ -1655,17 +1656,23 @@ func Test_splitscroll_with_splits()
|
|||||||
execute tab ? 'tabnew' : ''
|
execute tab ? 'tabnew' : ''
|
||||||
execute winbar ? 'nnoremenu 1.10 WinBar.Test :echo' : ''
|
execute winbar ? 'nnoremenu 1.10 WinBar.Test :echo' : ''
|
||||||
call setline(1, range(1, 256))
|
call setline(1, range(1, 256))
|
||||||
execute 'norm gg' . pos
|
" No scroll for restore_snapshot
|
||||||
" No scroll for vertical split and quit
|
norm G
|
||||||
vsplit | quit
|
try
|
||||||
call assert_equal(1, line("w0"))
|
copen | close | colder
|
||||||
|
catch /E380/
|
||||||
|
endtry
|
||||||
|
call assert_equal(257 - winheight(0), line("w0"))
|
||||||
|
|
||||||
" No scroll for horizontal split
|
" No scroll for firstwin horizontal split
|
||||||
split | redraw! | wincmd k
|
execute 'norm gg' . pos
|
||||||
|
split | redraw | wincmd k
|
||||||
call assert_equal(1, line("w0"))
|
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
|
" No scroll when resizing windows
|
||||||
resize +2
|
wincmd k | resize +2
|
||||||
call assert_equal(1, line("w0"))
|
call assert_equal(1, line("w0"))
|
||||||
wincmd j
|
wincmd j
|
||||||
call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
||||||
@@ -1715,7 +1722,7 @@ func Test_splitscroll_with_splits()
|
|||||||
call assert_equal(1, line("w0"))
|
call assert_equal(1, line("w0"))
|
||||||
|
|
||||||
" No scroll in windows split and quit multiple times
|
" No scroll in windows split and quit multiple times
|
||||||
quit | split | split | quit
|
quit | redraw | split | redraw | split | redraw | quit | redraw
|
||||||
call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
call assert_equal(win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
||||||
|
|
||||||
" No scroll for new buffer
|
" No scroll for new buffer
|
||||||
@@ -1740,11 +1747,9 @@ func Test_splitscroll_with_splits()
|
|||||||
call assert_equal(6, line("w0"))
|
call assert_equal(6, line("w0"))
|
||||||
wincmd j
|
wincmd j
|
||||||
call assert_equal(5 + win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
call assert_equal(5 + win_screenpos(0)[0] - tabline - winbar_sb, line("w0"))
|
||||||
only
|
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
tabonly!
|
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
@@ -703,6 +703,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
455,
|
||||||
/**/
|
/**/
|
||||||
454,
|
454,
|
||||||
/**/
|
/**/
|
||||||
|
13
src/window.c
13
src/window.c
@@ -3923,6 +3923,7 @@ new_frame(win_T *wp)
|
|||||||
win_init_size(void)
|
win_init_size(void)
|
||||||
{
|
{
|
||||||
firstwin->w_height = ROWS_AVAIL;
|
firstwin->w_height = ROWS_AVAIL;
|
||||||
|
firstwin->w_prev_height = ROWS_AVAIL;
|
||||||
topframe->fr_height = ROWS_AVAIL;
|
topframe->fr_height = ROWS_AVAIL;
|
||||||
firstwin->w_width = Columns;
|
firstwin->w_width = Columns;
|
||||||
topframe->fr_width = Columns;
|
topframe->fr_width = Columns;
|
||||||
@@ -4069,6 +4070,7 @@ win_new_tabpage(int after)
|
|||||||
|
|
||||||
win_init_size();
|
win_init_size();
|
||||||
firstwin->w_winrow = tabline_height();
|
firstwin->w_winrow = tabline_height();
|
||||||
|
firstwin->w_prev_winrow = firstwin->w_winrow;
|
||||||
win_comp_scroll(curwin);
|
win_comp_scroll(curwin);
|
||||||
|
|
||||||
newtp->tp_topframe = topframe;
|
newtp->tp_topframe = topframe;
|
||||||
@@ -6372,10 +6374,8 @@ win_fix_scroll(int resize)
|
|||||||
{
|
{
|
||||||
lnum = wp->w_cursor.lnum;
|
lnum = wp->w_cursor.lnum;
|
||||||
wp->w_cursor.lnum = MIN(wp->w_buffer->b_ml.ml_line_count,
|
wp->w_cursor.lnum = MIN(wp->w_buffer->b_ml.ml_line_count,
|
||||||
wp->w_botline - 1 + (wp->w_prev_height
|
wp->w_botline - 1 + (wp->w_winrow - wp->w_prev_winrow)
|
||||||
? (wp->w_winrow - wp->w_prev_winrow)
|
+ (wp->w_height - wp->w_prev_height));
|
||||||
+ (wp->w_height - wp->w_prev_height)
|
|
||||||
: -WINBAR_HEIGHT(wp)));
|
|
||||||
// Bring the new cursor position to the bottom of the screen.
|
// Bring the new cursor position to the bottom of the screen.
|
||||||
wp->w_fraction = FRACTION_MULT;
|
wp->w_fraction = FRACTION_MULT;
|
||||||
scroll_to_fraction(wp, wp->w_prev_height);
|
scroll_to_fraction(wp, wp->w_prev_height);
|
||||||
@@ -6802,6 +6802,9 @@ last_status_rec(frame_T *fr, int statusline)
|
|||||||
comp_col();
|
comp_col();
|
||||||
redraw_all_later(UPD_SOME_VALID);
|
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)
|
else if (fr->fr_layout == FR_ROW)
|
||||||
{
|
{
|
||||||
@@ -7091,6 +7094,8 @@ restore_snapshot(
|
|||||||
win_comp_pos();
|
win_comp_pos();
|
||||||
if (wp != NULL && close_curwin)
|
if (wp != NULL && close_curwin)
|
||||||
win_goto(wp);
|
win_goto(wp);
|
||||||
|
if (!p_spsc)
|
||||||
|
win_fix_scroll(FALSE);
|
||||||
redraw_all_later(UPD_NOT_VALID);
|
redraw_all_later(UPD_NOT_VALID);
|
||||||
}
|
}
|
||||||
clear_snapshot(curtab, idx);
|
clear_snapshot(curtab, idx);
|
||||||
|
Reference in New Issue
Block a user