mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
vim-patch:9.0.0892: may redraw when not needed
Problem: May redraw when not needed, causing slow scrolling.
Solution: Do not redraw when w_skipcol doesn't change. When w_skipcol
changes only redraw from the top. (issue vim/vim#11559)
f32fb93e43
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
88d13d2778
commit
5e4df766f6
@ -504,6 +504,7 @@ static void may_do_incsearch_highlighting(int firstc, long count, incsearch_stat
|
||||
}
|
||||
|
||||
validate_cursor();
|
||||
|
||||
// May redraw the status line to show the cursor position.
|
||||
if (p_ru && (curwin->w_status_height > 0 || global_stl_height() > 0)) {
|
||||
curwin->w_redr_status = true;
|
||||
@ -598,6 +599,7 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool
|
||||
magic_overruled = s->magic_overruled_save;
|
||||
|
||||
validate_cursor(); // needed for TAB
|
||||
status_redraw_all();
|
||||
redraw_all_later(UPD_SOME_VALID);
|
||||
if (call_update_screen) {
|
||||
update_screen();
|
||||
|
@ -164,6 +164,19 @@ static void redraw_for_cursorcolumn(win_T *wp)
|
||||
}
|
||||
}
|
||||
|
||||
/// Set wp->s_skipcol to zero and redraw later if needed.
|
||||
static void reset_skipcol(win_T *wp)
|
||||
{
|
||||
if (wp->w_skipcol != 0) {
|
||||
wp->w_skipcol = 0;
|
||||
|
||||
// Should use the least expensive way that displays all that changed.
|
||||
// UPD_NOT_VALID is too expensive, UPD_REDRAW_TOP does not redraw
|
||||
// enough when the top line gets another screen line.
|
||||
redraw_later(wp, UPD_SOME_VALID);
|
||||
}
|
||||
}
|
||||
|
||||
// Update curwin->w_topline to move the cursor onto the screen.
|
||||
void update_topline(win_T *wp)
|
||||
{
|
||||
@ -360,12 +373,9 @@ void update_topline(win_T *wp)
|
||||
if (wp->w_topline != old_topline
|
||||
|| wp->w_topfill != old_topfill) {
|
||||
dollar_vcol = -1;
|
||||
if (wp->w_skipcol != 0) {
|
||||
wp->w_skipcol = 0;
|
||||
redraw_later(wp, UPD_NOT_VALID);
|
||||
} else {
|
||||
redraw_later(wp, UPD_VALID);
|
||||
}
|
||||
redraw_later(wp, UPD_VALID);
|
||||
reset_skipcol(wp);
|
||||
|
||||
// May need to set w_skipcol when cursor in w_topline.
|
||||
if (wp->w_cursor.lnum == wp->w_topline) {
|
||||
validate_cursor();
|
||||
@ -983,7 +993,7 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
wp->w_skipcol = 0;
|
||||
}
|
||||
if (prev_skipcol != wp->w_skipcol) {
|
||||
redraw_later(wp, UPD_NOT_VALID);
|
||||
redraw_later(wp, UPD_SOME_VALID);
|
||||
}
|
||||
|
||||
redraw_for_cursorcolumn(wp);
|
||||
@ -1429,10 +1439,7 @@ void adjust_skipcol(void)
|
||||
validate_cheight();
|
||||
if (curwin->w_cline_height == curwin->w_height) {
|
||||
// the line just fits in the window, don't scroll
|
||||
if (curwin->w_skipcol != 0) {
|
||||
curwin->w_skipcol = 0;
|
||||
redraw_later(curwin, UPD_NOT_VALID);
|
||||
}
|
||||
reset_skipcol(curwin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1758,8 +1765,7 @@ void scroll_cursor_top(int min_scroll, int always)
|
||||
check_topfill(curwin, false);
|
||||
// TODO(vim): if the line doesn't fit may optimize w_skipcol
|
||||
if (curwin->w_topline == curwin->w_cursor.lnum) {
|
||||
curwin->w_skipcol = 0;
|
||||
redraw_later(curwin, UPD_NOT_VALID);
|
||||
reset_skipcol(curwin);
|
||||
}
|
||||
if (curwin->w_topline != old_topline
|
||||
|| curwin->w_skipcol != old_skipcol
|
||||
@ -2115,7 +2121,7 @@ void cursor_correct(void)
|
||||
// 'smoothscroll is active
|
||||
if (curwin->w_cline_height == curwin->w_height) {
|
||||
// The cursor line just fits in the window, don't scroll.
|
||||
curwin->w_skipcol = 0;
|
||||
reset_skipcol(curwin);
|
||||
return;
|
||||
}
|
||||
// TODO(vim): If the cursor line doesn't fit in the window then only adjust w_skipcol.
|
||||
|
@ -17,7 +17,6 @@ source test_global.vim
|
||||
source test_move.vim
|
||||
source test_put.vim
|
||||
source test_reltime.vim
|
||||
source test_scroll_opt.vim
|
||||
source test_searchpos.vim
|
||||
source test_set.vim
|
||||
source test_shift.vim
|
||||
|
Loading…
Reference in New Issue
Block a user