Loading ...
Sorry, an error occurred while loading the content.

Patch 7.3.759

Expand Messages
  • Bram Moolenaar
    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
    Message 1 of 3 , Dec 12, 2012
    • 0 Attachment
      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@... -- 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 ///

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • char101
      ... Setting WM_SETREDRAW to TRUE is not enough. At least in my computer (Win XP), the tabline is not repainted after deleting a tab. It needs to call
      Message 2 of 3 , Dec 15, 2012
      • 0 Attachment
        On Wednesday, December 12, 2012 11:12:40 PM UTC+7, Bram Moolenaar wrote:
        > 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
        > + /* Re-enable redraw. This should trigger a repaint. */
        >
        > + SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);

        Setting WM_SETREDRAW to TRUE is not enough. At least in my computer (Win XP), the tabline is not repainted after deleting a tab. It needs to call RedrawWindows after it.

        /* Re-enable redraw. This should trigger a repaint. */
        SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
        RedrawWindow(s_tabhwnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Bram Moolenaar
        ... OK, but wouldn t this cause the tabline to be drawn twice in some systems? -- hundred-and-one symptoms of being an internet addict: 165. You have a web
        Message 3 of 3 , Dec 15, 2012
        • 0 Attachment
          peacech wrote:

          > On Wednesday, December 12, 2012 11:12:40 PM UTC+7, Bram Moolenaar wrote:
          > > 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
          > > + /* Re-enable redraw. This should trigger a repaint. */
          > >
          > > + SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
          >
          > Setting WM_SETREDRAW to TRUE is not enough. At least in my computer
          > (Win XP), the tabline is not repainted after deleting a tab. It needs
          > to call RedrawWindows after it.
          >
          > /* Re-enable redraw. This should trigger a repaint. */
          > SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
          > RedrawWindow(s_tabhwnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);

          OK, but wouldn't this cause the tabline to be drawn twice in some
          systems?

          --
          hundred-and-one symptoms of being an internet addict:
          165. You have a web page burned into your glasses

          /// Bram Moolenaar -- Bram@... -- 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 ///

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.