To: vim_dev@googlegroups.com Subject: Patch 8.1.0372 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0372 Problem: Screen updating slow when 'cursorline' is set. Solution: Only redraw the old and new cursor line, not all lines. Files: src/edit.c, src/move.c, src/screen.c, src/proto/screen.pro *** ../vim-8.1.0371/src/edit.c 2018-08-08 22:08:28.326846653 +0200 --- src/edit.c 2018-09-12 21:39:50.838327555 +0200 *************** *** 1966,1972 **** if (pc_status == PC_STATUS_RIGHT) ++curwin->w_wcol; if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) ! redrawWinline(curwin->w_cursor.lnum, FALSE); else #endif screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr); --- 1966,1972 ---- if (pc_status == PC_STATUS_RIGHT) ++curwin->w_wcol; if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) ! redrawWinline(curwin, curwin->w_cursor.lnum, FALSE); else #endif screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr); *************** *** 2017,2023 **** if (dollar_vcol >= 0) { dollar_vcol = -1; ! redrawWinline(curwin->w_cursor.lnum, FALSE); } } --- 2017,2023 ---- if (dollar_vcol >= 0) { dollar_vcol = -1; ! redrawWinline(curwin, curwin->w_cursor.lnum, FALSE); } } *************** *** 7079,7085 **** linenr_T lnum = spell_redraw_lnum; spell_redraw_lnum = 0; ! redrawWinline(lnum, FALSE); } } --- 7079,7085 ---- linenr_T lnum = spell_redraw_lnum; spell_redraw_lnum = 0; ! redrawWinline(curwin, lnum, FALSE); } } *** ../vim-8.1.0371/src/move.c 2018-07-10 15:07:11.779668824 +0200 --- src/move.c 2018-09-12 21:43:54.096174935 +0200 *************** *** 123,128 **** --- 123,132 ---- set_empty_rows(wp, done); } + #ifdef FEAT_SYN_HL + static linenr_T last_cursorline = 0; + #endif + /* * Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is * set. *************** *** 140,146 **** && !pum_visible() # endif ) ! redraw_win_later(wp, SOME_VALID); } /* --- 144,165 ---- && !pum_visible() # endif ) ! { ! #ifdef FEAT_SYN_HL ! if (!wp->w_p_rnu && wp->w_redr_type <= VALID && last_cursorline != 0) ! { ! // "last_cursorline" may be set for another window, worst case we ! // redraw too much. This is optimized for moving the cursor around ! // in the same window. ! redrawWinline(wp, last_cursorline, FALSE); ! redrawWinline(wp, wp->w_cursor.lnum, FALSE); ! last_cursorline = wp->w_cursor.lnum; ! redraw_win_later(wp, VALID); ! } ! else ! #endif ! redraw_win_later(wp, SOME_VALID); ! } } /* *** ../vim-8.1.0371/src/screen.c 2018-09-06 13:14:39.144722527 +0200 --- src/screen.c 2018-09-12 21:41:32.553424559 +0200 *************** *** 496,501 **** --- 496,502 ---- */ void redrawWinline( + win_T *wp, linenr_T lnum, int invalid UNUSED) /* window line height is invalid now */ { *************** *** 503,521 **** int i; #endif ! if (curwin->w_redraw_top == 0 || curwin->w_redraw_top > lnum) ! curwin->w_redraw_top = lnum; ! if (curwin->w_redraw_bot == 0 || curwin->w_redraw_bot < lnum) ! curwin->w_redraw_bot = lnum; ! redraw_later(VALID); #ifdef FEAT_FOLDING if (invalid) { /* A w_lines[] entry for this lnum has become invalid. */ ! i = find_wl_entry(curwin, lnum); if (i >= 0) ! curwin->w_lines[i].wl_valid = FALSE; } #endif } --- 504,522 ---- int i; #endif ! if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum) ! wp->w_redraw_top = lnum; ! if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum) ! wp->w_redraw_bot = lnum; ! redraw_win_later(wp, VALID); #ifdef FEAT_FOLDING if (invalid) { /* A w_lines[] entry for this lnum has become invalid. */ ! i = find_wl_entry(wp, lnum); if (i >= 0) ! wp->w_lines[i].wl_valid = FALSE; } #endif } *** ../vim-8.1.0371/src/proto/screen.pro 2018-06-16 15:32:34.460024472 +0200 --- src/proto/screen.pro 2018-09-12 21:41:33.929412376 +0200 *************** *** 8,14 **** void redraw_buf_and_status_later(buf_T *buf, int type); int redraw_asap(int type); void redraw_after_callback(int call_update_screen); ! void redrawWinline(linenr_T lnum, int invalid); void reset_updating_screen(int may_resize_shell); void update_curbuf(int type); int update_screen(int type_arg); --- 8,14 ---- void redraw_buf_and_status_later(buf_T *buf, int type); int redraw_asap(int type); void redraw_after_callback(int call_update_screen); ! void redrawWinline(win_T *wp, linenr_T lnum, int invalid); void reset_updating_screen(int may_resize_shell); void update_curbuf(int type); int update_screen(int type_arg); *** ../vim-8.1.0371/src/version.c 2018-09-12 20:29:05.479670601 +0200 --- src/version.c 2018-09-12 21:51:28.616197716 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 372, /**/ -- Despite the cost of living, have you noticed how it remains so popular? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///