To: vim_dev@googlegroups.com Subject: Patch 8.1.2214 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2214 Problem: Too much is redrawn when 'cursorline' is set. Solution: Don't do a complete redraw. (closes #5079) Files: src/main.c, src/change.c, src/drawscreen.c, src/testdir/dumps/Test_Xcursorline_13.dump, src/testdir/dumps/Test_Xcursorline_14.dump, src/testdir/dumps/Test_Xcursorline_15.dump, src/testdir/dumps/Test_Xcursorline_16.dump, src/testdir/dumps/Test_Xcursorline_17.dump, src/testdir/dumps/Test_Xcursorline_18.dump *** ../vim-8.1.2213/src/main.c 2019-10-13 16:43:35.956359658 +0200 --- src/main.c 2019-10-24 21:31:40.373294129 +0200 *************** *** 1380,1406 **** validate_cursor(); #ifdef FEAT_SYN_HL ! if (curwin->w_p_cul && curwin->w_p_wrap ! && (curwin->w_p_culopt_flags & CULOPT_SCRLINE)) ! must_redraw = NOT_VALID; #endif - if (VIsual_active) update_curbuf(INVERTED); // update inverted part else if (must_redraw) { mch_disable_flush(); // Stop issuing gui_mch_flush(). ! #ifdef FEAT_SYN_HL ! // Might need some more update for the cursorscreen line. ! // TODO: can we optimize this? ! if (curwin->w_p_cul ! && curwin->w_p_wrap ! && (curwin->w_p_culopt_flags & CULOPT_SCRLINE) ! && !char_avail()) ! update_screen(VALID); ! else ! #endif ! update_screen(0); mch_enable_flush(); } else if (redraw_cmdline || clear_cmdline) --- 1380,1399 ---- validate_cursor(); #ifdef FEAT_SYN_HL ! // Might need to update for 'cursorline'. ! // When 'cursorlineopt' is "screenline" need to redraw always. ! if (curwin->w_p_cul ! && (curwin->w_last_cursorline != curwin->w_cursor.lnum ! || (curwin->w_p_culopt_flags & CULOPT_SCRLINE)) ! && !char_avail()) ! redraw_later(VALID); #endif if (VIsual_active) update_curbuf(INVERTED); // update inverted part else if (must_redraw) { mch_disable_flush(); // Stop issuing gui_mch_flush(). ! update_screen(0); mch_enable_flush(); } else if (redraw_cmdline || clear_cmdline) *** ../vim-8.1.2213/src/change.c 2019-10-24 20:07:04.419105304 +0200 --- src/change.c 2019-10-24 22:26:53.069615100 +0200 *************** *** 609,624 **** if (hasAnyFolding(wp)) set_topline(wp, wp->w_topline); #endif ! // Relative numbering may require updating more. Cursor line ! // highlighting probably needs to be updated if it's below the ! // change (or is using screenline highlighting) ! if (wp->w_p_rnu #ifdef FEAT_SYN_HL ! || ((wp->w_p_cul && lnum <= wp->w_last_cursorline) ! || (wp->w_p_culopt_flags & CULOPT_SCRLINE)) #endif - ) - redraw_win_later(wp, SOME_VALID); } } --- 609,629 ---- if (hasAnyFolding(wp)) set_topline(wp, wp->w_topline); #endif ! // Relative numbering may require updating more. ! if (wp->w_p_rnu) ! redraw_win_later(wp, SOME_VALID); #ifdef FEAT_SYN_HL ! // Cursor line highlighting probably need to be updated with ! // "VALID" if it's below the change. ! // If the cursor line is inside the change we need to redraw more. ! if (wp->w_p_cul) ! { ! if (xtra == 0) ! redraw_win_later(wp, VALID); ! else if (lnum <= wp->w_last_cursorline) ! redraw_win_later(wp, SOME_VALID); ! } #endif } } *** ../vim-8.1.2213/src/drawscreen.c 2019-09-19 23:05:56.471034946 +0200 --- src/drawscreen.c 2019-10-24 21:24:50.678976250 +0200 *************** *** 2124,2130 **** || (wp->w_match_head != NULL && buf->b_mod_xlines != 0) #endif ! ))))) { #ifdef FEAT_SEARCH_EXTRA if (lnum == mod_top) --- 2124,2135 ---- || (wp->w_match_head != NULL && buf->b_mod_xlines != 0) #endif ! )))) ! #ifdef FEAT_SYN_HL ! || (wp->w_p_cul && (lnum == wp->w_cursor.lnum ! || lnum == wp->w_last_cursorline)) ! #endif ! ) { #ifdef FEAT_SEARCH_EXTRA if (lnum == mod_top) *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_13.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_13.dump 2019-10-24 21:32:24.501256291 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|1| @5|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|1| @5|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_14.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_14.dump 2019-10-24 21:35:43.576967109 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|2|6|-|3|0| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|2|6|-|3|0| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_15.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_15.dump 2019-10-24 21:35:44.660965081 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|4|3|-|4|7| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|4|3|-|4|7| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_16.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_16.dump 2019-10-24 21:37:29.016751178 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|5|9|-|6|4| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|5|9|-|6|4| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_17.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_17.dump 2019-10-24 21:37:30.100748775 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|7|5|-|8|1| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|7|5|-|8|1| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/testdir/dumps/Test_Xcursorline_18.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_Xcursorline_18.dump 2019-10-24 21:37:31.184746368 +0200 *************** *** 17,20 **** | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|9|1|-|9|8| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! |:+0&&|s|e|t| |b|r|e|a|k|i|n|d|e|n|t| |f|o|l|d|c|o|l|u|m|n|=|2| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| @30 --- 17,20 ---- | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|i+0#0000000&|n|s|-+0#0000e05&|z+0#0000000&|w|e|i|-+0#0000e05&|d+0#0000000&|r|e|i|-+0#0000e05&|v+0#0000000&|i||+1&&|~+0#4040ff13&| @47 | +0#0000e05#a8a8a8255@3| +0#af5f00255#ffffff0@3|>+0#4040ff13&|e+0#0000000&|r|-+0#0000e05&|f+0#0000000&|ü|n|f|-+0#0000e05&|s+0#0000000&|e|c|h|s|@+0#4040ff13&@2||+1#0000000&|~+0#4040ff13&| @47 |<+3#0000000&|o| |N|a|m|e|]| |[|+|]| |1|,|9|1|-|9|8| @1|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @17|5|,|0|-|1| @9|B|o|t ! | +0&&@74 *** ../vim-8.1.2213/src/version.c 2019-10-24 22:12:51.569124167 +0200 --- src/version.c 2019-10-24 22:31:25.872529334 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2214, /**/ -- Managers are like cats in a litter box. They instinctively shuffle things around to conceal what they've done. (Scott Adams - The Dilbert principle) /// 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 ///