home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.781 < prev    next >
Encoding:
Internet Message Format  |  2013-01-22  |  5.1 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.781
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.781
  11. Problem:    Drawing with 'guifontwide' can be slow.
  12. Solution:   Draw multiple characters at a time. (Taro Muraoka)
  13. Files:        src/gui.c
  14.  
  15.  
  16. *** ../vim-7.3.780/src/gui.c    2012-11-20 12:03:02.000000000 +0100
  17. --- src/gui.c    2013-01-23 17:28:48.000000000 +0100
  18. ***************
  19. *** 2380,2386 ****
  20.       int    cl;        /* byte length of current char */
  21.       int    comping;    /* current char is composing */
  22.       int    scol = col;    /* screen column */
  23. !     int    dowide;        /* use 'guifontwide' */
  24.   
  25.       /* Break the string at a composing character, it has to be drawn on
  26.        * top of the previous character. */
  27. --- 2380,2388 ----
  28.       int    cl;        /* byte length of current char */
  29.       int    comping;    /* current char is composing */
  30.       int    scol = col;    /* screen column */
  31. !     int    curr_wide;    /* use 'guifontwide' */
  32. !     int    prev_wide = FALSE;
  33. !     int    wide_changed;
  34.   
  35.       /* Break the string at a composing character, it has to be drawn on
  36.        * top of the previous character. */
  37. ***************
  38. *** 2395,2403 ****
  39.               && fontset == NOFONTSET
  40.   #  endif
  41.               && gui.wide_font != NOFONT)
  42. !         dowide = TRUE;
  43.           else
  44. !         dowide = FALSE;
  45.           comping = utf_iscomposing(c);
  46.           if (!comping)    /* count cells from non-composing chars */
  47.           cells += cn;
  48. --- 2397,2405 ----
  49.               && fontset == NOFONTSET
  50.   #  endif
  51.               && gui.wide_font != NOFONT)
  52. !         curr_wide = TRUE;
  53.           else
  54. !         curr_wide = FALSE;
  55.           comping = utf_iscomposing(c);
  56.           if (!comping)    /* count cells from non-composing chars */
  57.           cells += cn;
  58. ***************
  59. *** 2405,2413 ****
  60.           if (cl == 0)    /* hit end of string */
  61.           len = i + cl;    /* len must be wrong "cannot happen" */
  62.   
  63. !         /* print the string so far if it's the last character or there is
  64.            * a composing character. */
  65. !         if (i + cl >= len || (comping && i > start) || dowide
  66.   #  if defined(FEAT_GUI_X11)
  67.               || (cn > 1
  68.   #   ifdef FEAT_XFONTSET
  69. --- 2407,2417 ----
  70.           if (cl == 0)    /* hit end of string */
  71.           len = i + cl;    /* len must be wrong "cannot happen" */
  72.   
  73. !         wide_changed = curr_wide != prev_wide;
  74. !         /* Print the string so far if it's the last character or there is
  75.            * a composing character. */
  76. !         if (i + cl >= len || (comping && i > start) || wide_changed
  77.   #  if defined(FEAT_GUI_X11)
  78.               || (cn > 1
  79.   #   ifdef FEAT_XFONTSET
  80. ***************
  81. *** 2419,2443 ****
  82.   #  endif
  83.              )
  84.           {
  85. !         if (comping || dowide)
  86.               thislen = i - start;
  87.           else
  88.               thislen = i - start + cl;
  89.           if (thislen > 0)
  90.           {
  91.               gui_mch_draw_string(gui.row, scol, s + start, thislen,
  92.                                     draw_flags);
  93.               start += thislen;
  94.           }
  95.           scol += cells;
  96.           cells = 0;
  97. !         if (dowide)
  98.           {
  99. !             gui_mch_set_font(gui.wide_font);
  100. !             gui_mch_draw_string(gui.row, scol - cn,
  101. !                            s + start, cl, draw_flags);
  102. !             gui_mch_set_font(font);
  103. !             start += cl;
  104.           }
  105.   
  106.   #  if defined(FEAT_GUI_X11)
  107. --- 2423,2450 ----
  108.   #  endif
  109.              )
  110.           {
  111. !         if (comping || wide_changed)
  112.               thislen = i - start;
  113.           else
  114.               thislen = i - start + cl;
  115.           if (thislen > 0)
  116.           {
  117. +             if (prev_wide)
  118. +             gui_mch_set_font(gui.wide_font);
  119.               gui_mch_draw_string(gui.row, scol, s + start, thislen,
  120.                                     draw_flags);
  121. +             if (prev_wide)
  122. +             gui_mch_set_font(font);
  123.               start += thislen;
  124.           }
  125.           scol += cells;
  126.           cells = 0;
  127. !         /* Adjust to not draw a character which width is changed
  128. !          * against with last one. */
  129. !         if (wide_changed && !comping)
  130.           {
  131. !             scol -= cn;
  132. !             cl = 0;
  133.           }
  134.   
  135.   #  if defined(FEAT_GUI_X11)
  136. ***************
  137. *** 2447,2453 ****
  138.   #   ifdef FEAT_XFONTSET
  139.               && fontset == NOFONTSET
  140.   #   endif
  141. !             && !dowide)
  142.               gui_mch_draw_string(gui.row, scol - 1, (char_u *)" ",
  143.                                      1, draw_flags);
  144.   #  endif
  145. --- 2454,2460 ----
  146.   #   ifdef FEAT_XFONTSET
  147.               && fontset == NOFONTSET
  148.   #   endif
  149. !             && !wide_changed)
  150.               gui_mch_draw_string(gui.row, scol - 1, (char_u *)" ",
  151.                                      1, draw_flags);
  152.   #  endif
  153. ***************
  154. *** 2465,2470 ****
  155. --- 2472,2478 ----
  156.   #  endif
  157.           start = i + cl;
  158.           }
  159. +         prev_wide = curr_wide;
  160.       }
  161.       /* The stuff below assumes "len" is the length in screen columns. */
  162.       len = scol - col;
  163. *** ../vim-7.3.780/src/version.c    2013-01-23 17:15:25.000000000 +0100
  164. --- src/version.c    2013-01-23 17:28:17.000000000 +0100
  165. ***************
  166. *** 727,728 ****
  167. --- 727,730 ----
  168.   {   /* Add new patch number below this line */
  169. + /**/
  170. +     781,
  171.   /**/
  172.  
  173. -- 
  174. GUARD #1:  Where'd you get the coconut?
  175. ARTHUR:    We found them.
  176. GUARD #1:  Found them?  In Mercea?  The coconut's tropical!
  177. ARTHUR:    What do you mean?
  178. GUARD #1:  Well, this is a temperate zone.
  179.                                   The Quest for the Holy Grail (Monty Python)
  180.  
  181.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  182. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  183. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  184.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  185.