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