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