To: vim_dev@googlegroups.com
Subject: Patch 7.3.759
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.759
Problem:    MS-Windows: Updating the tabline is slow when there are many tabs.
Solution:   Disable redrawing while performing the update. (Arseny Kapoulkine)
Files:	    src/gui_w48.c


*** ../vim-7.3.758/src/gui_w48.c	2012-11-20 16:53:34.000000000 +0100
--- src/gui_w48.c	2012-12-12 17:10:21.000000000 +0100
***************
*** 2452,2458 ****
      TCITEM	tie;
      int		nr = 0;
      int		curtabidx = 0;
-     RECT	rc;
  #ifdef FEAT_MBYTE
      static int	use_unicode = FALSE;
      int		uu;
--- 2452,2457 ----
***************
*** 2479,2491 ****
      tie.mask = TCIF_TEXT;
      tie.iImage = -1;
  
      /* Add a label for each tab page.  They all contain the same text area. */
      for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr)
      {
  	if (tp == curtab)
  	    curtabidx = nr;
  
! 	if (!TabCtrl_GetItemRect(s_tabhwnd, nr, &rc))
  	{
  	    /* Add the tab */
  	    tie.pszText = "-Empty-";
--- 2478,2493 ----
      tie.mask = TCIF_TEXT;
      tie.iImage = -1;
  
+     /* Disable redraw for tab updates to eliminate O(N^2) draws. */
+     SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0);
+ 
      /* Add a label for each tab page.  They all contain the same text area. */
      for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr)
      {
  	if (tp == curtab)
  	    curtabidx = nr;
  
! 	if (nr >= TabCtrl_GetItemCount(s_tabhwnd))
  	{
  	    /* Add the tab */
  	    tie.pszText = "-Empty-";
***************
*** 2519,2529 ****
      }
  
      /* Remove any old labels. */
!     while (TabCtrl_GetItemRect(s_tabhwnd, nr, &rc))
  	TabCtrl_DeleteItem(s_tabhwnd, nr);
  
      if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
  	TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
  }
  
  /*
--- 2521,2534 ----
      }
  
      /* Remove any old labels. */
!     while (nr < TabCtrl_GetItemCount(s_tabhwnd))
  	TabCtrl_DeleteItem(s_tabhwnd, nr);
  
      if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
  	TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
+ 
+     /* Re-enable redraw. This should trigger a repaint. */
+     SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
  }
  
  /*
*** ../vim-7.3.758/src/version.c	2012-12-12 16:43:52.000000000 +0100
--- src/version.c	2012-12-12 17:10:46.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
  {   /* Add new patch number below this line */
+ /**/
+     759,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
148. You find it easier to dial-up the National Weather Service
     Weather/your_town/now.html than to simply look out the window.

 /// 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    ///
