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