To: vim_dev@googlegroups.com Subject: Patch 8.2.4673 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4673 Problem: Redrawing a vertically split window is slow when using CTRL-F and CTRL-B. Solution: When deciding on USE_REDRAW bail out if scrolling more than three lines. (issue #8002) Files: src/screen.c *** ../vim-8.2.4672/src/screen.c 2022-04-01 19:44:43.949807161 +0100 --- src/screen.c 2022-04-03 13:17:37.951718866 +0100 *************** *** 3707,3713 **** --- 3707,3721 ---- */ result_empty = (row + line_count >= end); if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) + { + // Avoid that lines are first cleared here and then redrawn, which + // results in many characters updated twice. This happens with CTRL-F + // in a vertically split window. With line-by-line scrolling + // USE_REDRAW should be faster. + if (line_count > 3) + return FAIL; type = USE_REDRAW; + } else if (can_clear(T_CD) && result_empty) type = USE_T_CD; else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) *************** *** 3879,3885 **** int end, int force, // even when line_count > p_ttyscroll int clear_attr, // used for clearing lines ! win_T *wp UNUSED) // NULL or window to use width from { int j; int i; --- 3887,3893 ---- int end, int force, // even when line_count > p_ttyscroll int clear_attr, // used for clearing lines ! win_T *wp) // NULL or window to use width from { int j; int i; *************** *** 3934,3940 **** --- 3942,3956 ---- * 6. redraw the characters from ScreenLines[]. */ if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) + { + // Avoid that lines are first cleared here and then redrawn, which + // results in many characters updated twice. This happens with CTRL-F + // in a vertically split window. With line-by-line scrolling + // USE_REDRAW should be faster. + if (line_count > 3) + return FAIL; type = USE_REDRAW; + } else if (can_clear(T_CD) && result_empty) type = USE_T_CD; else if (row == 0 && ( *** ../vim-8.2.4672/src/version.c 2022-04-03 12:59:29.358392492 +0100 --- src/version.c 2022-04-03 13:20:36.755190970 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4673, /**/ -- VOICE OVER: As the horrendous Black Beast lunged forward, escape for Arthur and his knights seemed hopeless, when, suddenly ... the animator suffered a fatal heart attack. ANIMATOR: Aaaaagh! VOICE OVER: The cartoon peril was no more ... The Quest for Holy Grail could continue. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///