To: vim-dev@vim.org Subject: patch 7.1.045 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.1.045 Problem: Unnecessary screen redrawing. (Jjgod Jiang) Solution: Reset "must_redraw" after clearing the screen. Files: src/screen.c *** ../vim-7.1.044/src/screen.c Thu Jul 26 22:55:11 2007 --- src/screen.c Mon Jul 30 21:39:32 2007 *************** *** 331,336 **** --- 331,341 ---- { if (type < must_redraw) /* use maximal type */ type = must_redraw; + + /* must_redraw is reset here, so that when we run into some weird + * reason to redraw while busy redrawing (e.g., asynchronous + * scrolling), or update_topline() in win_update() will cause a + * scroll, the screen will be redrawn later or in win_update(). */ must_redraw = 0; } *************** *** 1019,1024 **** --- 1024,1036 ---- type = VALID; } + /* Trick: we want to avoid clearning the screen twice. screenclear() will + * set "screen_cleared" to TRUE. The special value MAYBE (which is still + * non-zero and thus not FALSE) will indicate that screenclear() was not + * called. */ + if (screen_cleared) + screen_cleared = MAYBE; + /* * If there are no changes on the screen that require a complete redraw, * handle three cases: *************** *** 1220,1226 **** mid_end = wp->w_height; if (lastwin == firstwin) { ! screenclear(); #ifdef FEAT_WINDOWS /* The screen was cleared, redraw the tab pages line. */ if (redraw_tabline) --- 1232,1242 ---- mid_end = wp->w_height; if (lastwin == firstwin) { ! /* Clear the screen when it was not done by win_del_lines() or ! * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE ! * then. */ ! if (screen_cleared != TRUE) ! screenclear(); #ifdef FEAT_WINDOWS /* The screen was cleared, redraw the tab pages line. */ if (redraw_tabline) *************** *** 1228,1233 **** --- 1244,1256 ---- #endif } } + + /* When win_del_lines() or win_ins_lines() caused the screen to be + * cleared (only happens for the first window) or when screenclear() + * was called directly above, "must_redraw" will have been set to + * NOT_VALID, need to reset it here to avoid redrawing twice. */ + if (screen_cleared == TRUE) + must_redraw = 0; } else { *** ../vim-7.1.044/src/version.c Sun Jul 29 15:02:34 2007 --- src/version.c Mon Jul 30 21:58:06 2007 *************** *** 668,669 **** --- 668,671 ---- { /* Add new patch number below this line */ + /**/ + 45, /**/ -- Be thankful to be in a traffic jam, because it means you own a car. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///