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 / old / 5.6.060 < prev    next >
Encoding:
Internet Message Format  |  2000-04-04  |  8.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6.060
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.6.060
  8. Problem:    Some bold characters spill over the the cell on the left, that
  9.         spill-over can remain sometimes.
  10. Solution:   Redraw a characters when the next character was bold and needs
  11.         redrawing. (Robert Webb)
  12. Files:        src/screen.c
  13.  
  14.  
  15. *** ../vim-5.6.59/src/screen.c    Tue Apr  4 20:52:36 2000
  16. --- src/screen.c    Wed Apr  5 16:17:34 2000
  17. ***************
  18. *** 67,72 ****
  19. --- 67,73 ----
  20.   
  21.   static void win_update __ARGS((WIN *wp));
  22.   static int win_line __ARGS((WIN *, linenr_t, int, int));
  23. + static int char_needs_redraw __ARGS((char_u *screenp_from, char_u *screenp_to, int len));
  24.   #ifdef RIGHTLEFT
  25.   static void screen_line __ARGS((int row, int endcol, int clear_rest, int rlflag));
  26.   #define SCREEN_LINE(r, e, c, rl)    screen_line((r), (e), (c), (rl))
  27. ***************
  28. *** 1875,1880 ****
  29. --- 1876,1908 ----
  30.   }
  31.   
  32.   /*
  33. +  * Check whether the given character needs redrawing:
  34. +  * - the (first byte of the) character is different
  35. +  * - the attributes are different
  36. +  * - the character is multi-byte and the next byte is different
  37. +  */
  38. +     static int
  39. + char_needs_redraw(screenp_from, screenp_to, len)
  40. +     char_u *screenp_from;
  41. +     char_u *screenp_to;
  42. +     int len;
  43. + {
  44. +     if (len > 0
  45. +         && ((*screenp_from != *screenp_to
  46. +             || *(screenp_from + Columns) != *(screenp_to + Columns))
  47. + #ifdef MULTI_BYTE
  48. +         || (is_dbcs
  49. +             && len > 1
  50. +             && *(screenp_from + 1) != *(screenp_to + 1)
  51. +             && IsLeadByte(*screenp_from))
  52. + #endif
  53. +            ))
  54. +     return TRUE;
  55. +     return FALSE;
  56. + }
  57. + /*
  58.    * Move one "cooked" screen line to the screen, but only the characters that
  59.    * have actually changed.  Handle insert/delete character.
  60.    * 'endcol' gives the columns where valid characters are.
  61. ***************
  62. *** 1899,1909 ****
  63.       char_u        *screenp_from;
  64.       char_u        *screenp_to;
  65.       int            col = 0;
  66.       int            force = FALSE;    /* force update rest of the line */
  67.   #ifdef MULTI_BYTE
  68.       int            char_bytes;        /* 1 : if normal char */
  69.                       /* 2 : if DBCS char */
  70. !     int            need_update;    /* bool variable */
  71.   #endif
  72.   
  73.       screenp_from = current_LinePointer;
  74. --- 1927,1942 ----
  75.       char_u        *screenp_from;
  76.       char_u        *screenp_to;
  77.       int            col = 0;
  78. +     int            hl;
  79.       int            force = FALSE;    /* force update rest of the line */
  80. +     int            redraw_this;    /* bool: does character need redraw? */
  81. +     int            redraw_next;    /* redraw_this for next character */
  82.   #ifdef MULTI_BYTE
  83.       int            char_bytes;        /* 1 : if normal char */
  84.                       /* 2 : if DBCS char */
  85. ! # define CHAR_BYTES char_bytes
  86. ! #else
  87. ! # define CHAR_BYTES 1
  88.   #endif
  89.   
  90.       screenp_from = current_LinePointer;
  91. ***************
  92. *** 1926,1975 ****
  93.       col = endcol + 1;
  94.       screenp_to = LinePointers[row] + col;
  95.       screenp_from += col;
  96.       }
  97.   
  98. -     while (rlflag ? (col < Columns) : (col < endcol))
  99. - #else
  100.       while (col < endcol)
  101. - #endif
  102.       {
  103.   #ifdef MULTI_BYTE
  104. !     if (is_dbcs && IsLeadByte(*screenp_from) && (col + 1 < endcol))
  105. !     {
  106.           char_bytes = 2;
  107. -         if ( force
  108. -             || *screenp_from != *screenp_to
  109. -             || *(screenp_from + 1) != *(screenp_to + 1)
  110. -             || *(screenp_from + Columns) != *(screenp_to + Columns)
  111. -         )
  112. -         need_update = TRUE;
  113. -         else
  114. -         need_update = FALSE;
  115. -     }
  116.       else
  117. -     {
  118.           char_bytes = 1;
  119. -         if ( force
  120. -             || *screenp_from != *screenp_to
  121. -             || *(screenp_from + Columns) != *(screenp_to + Columns)
  122. -         )
  123. -         need_update = TRUE;
  124. -         else
  125. -         need_update = FALSE;
  126. -     }
  127.   #endif
  128.   
  129. !     if (
  130. ! #if defined(MULTI_BYTE)
  131. !         need_update
  132. ! #else
  133. !            force
  134. !         || *screenp_from != *screenp_to
  135. !         || *(screenp_from + Columns) != *(screenp_to + Columns)
  136. ! #endif
  137. !        )
  138.       {
  139.   
  140.           /*
  141.            * Special handling when 'xs' termcap flag set (hpterm):
  142.            * Attributes for characters are stored at the position where the
  143. --- 1959,1999 ----
  144.       col = endcol + 1;
  145.       screenp_to = LinePointers[row] + col;
  146.       screenp_from += col;
  147. +     endcol = Columns;
  148.       }
  149. + #endif /* RIGHTLEFT */
  150. +     redraw_next = char_needs_redraw(screenp_from, screenp_to, endcol - col);
  151.   
  152.       while (col < endcol)
  153.       {
  154.   #ifdef MULTI_BYTE
  155. !     if (is_dbcs && (col + 1 < endcol) && IsLeadByte(*screenp_from))
  156.           char_bytes = 2;
  157.       else
  158.           char_bytes = 1;
  159.   #endif
  160.   
  161. !     redraw_this = redraw_next;
  162. !     redraw_next = force || char_needs_redraw(screenp_from + CHAR_BYTES,
  163. !               screenp_to + CHAR_BYTES, endcol - col - CHAR_BYTES);
  164. ! #ifdef USE_GUI
  165. !     /* If the next character was bold, then redraw the current character to
  166. !      * remove any pixels that might have spilt over into us.  This only
  167. !      * happens in the GUI.
  168. !      */
  169. !     if (redraw_next && gui.in_use)
  170.       {
  171. +         hl = *(screenp_to + CHAR_BYTES + Columns);
  172. +         if (hl > HL_ALL || (hl & HL_BOLD))
  173. +         redraw_this = TRUE;
  174. +     }
  175. + #endif
  176.   
  177. +     if (redraw_this)
  178. +     {
  179.           /*
  180.            * Special handling when 'xs' termcap flag set (hpterm):
  181.            * Attributes for characters are stored at the position where the
  182. ***************
  183. *** 1997,2002 ****
  184. --- 2021,2027 ----
  185.           out_str(T_CE);        /* clear rest of this screen line */
  186.           screen_start();        /* don't know where cursor is now */
  187.           force = TRUE;        /* force redraw of rest of the line */
  188. +         redraw_next = TRUE;    /* or else next char would miss out */
  189.   
  190.           /*
  191.            * If the previous character was highlighted, need to stop
  192. ***************
  193. *** 2014,2027 ****
  194.   #ifdef MULTI_BYTE
  195.           if (is_dbcs)
  196.           {
  197. !         /* The trick to make a force update */
  198. !         if (!IsLeadByte(*screenp_from) && IsLeadByte(*screenp_to))
  199. !             *(screenp_to + 1) = 0;
  200. !         else if ((char_bytes == 2)
  201. !             && mb_isbyte1(LinePointers[row], col + 1))
  202.           {
  203.               *(screenp_to + 1) = 0;
  204.               *(screenp_to + 2) = 0;
  205.           }
  206.           }
  207.   #endif
  208. --- 2039,2059 ----
  209.   #ifdef MULTI_BYTE
  210.           if (is_dbcs)
  211.           {
  212. !         if (char_bytes == 1 && col + 1 < endcol
  213. !             && IsLeadByte(*screenp_to))
  214.           {
  215. +             /* When: !DBCS(*screenp_from) && DBCS(*screenp_to) */
  216.               *(screenp_to + 1) = 0;
  217. +             redraw_next = TRUE;
  218. +         }
  219. +         else if (char_bytes == 2 && col + 2 < endcol
  220. +             && !IsLeadByte(*screenp_to)
  221. +             && IsLeadByte(*(screenp_to + 1)))
  222. +         {
  223. +             /* When: DBCS(*screenp_from) && DBCS(*screenp_to+1) */
  224. +             /* *(screenp_to + 1) = 0; redundant code */
  225.               *(screenp_to + 2) = 0;
  226. +             redraw_next = TRUE;
  227.           }
  228.           }
  229.   #endif
  230. ***************
  231. *** 2049,2069 ****
  232.   # endif
  233.               )
  234.           {
  235. !         int        n;
  236. !         n = *(screenp_to + Columns);
  237. ! # ifdef MULTI_BYTE
  238. !         if (col + char_bytes < Columns && (n > HL_ALL || (n & HL_BOLD)))
  239. !             *(screenp_to + char_bytes) = 0;
  240. ! # else
  241. !         if (col + 1 < Columns && (n > HL_ALL || (n & HL_BOLD)))
  242. !             *(screenp_to + 1) = 0;
  243. ! # endif
  244.           }
  245.   #endif
  246.           *(screenp_to + Columns) = *(screenp_from + Columns);
  247.   #ifdef MULTI_BYTE
  248. !         if (char_bytes == 2)    /* just a hack */
  249.           *(screenp_to + Columns + 1) = *(screenp_from + Columns);
  250.           screen_char_n(screenp_to, char_bytes, row, col);
  251.   #else
  252. --- 2081,2095 ----
  253.   # endif
  254.               )
  255.           {
  256. !         hl = *(screenp_to + Columns);
  257. !         if (hl > HL_ALL || (hl & HL_BOLD))
  258. !             redraw_next = TRUE;
  259.           }
  260.   #endif
  261.           *(screenp_to + Columns) = *(screenp_from + Columns);
  262.   #ifdef MULTI_BYTE
  263. !         /* just a hack: It makes two bytes of DBCS have same attributes */
  264. !         if (char_bytes == 2)
  265.           *(screenp_to + Columns + 1) = *(screenp_from + Columns);
  266.           screen_char_n(screenp_to, char_bytes, row, col);
  267.   #else
  268. ***************
  269. *** 2090,2104 ****
  270.           }
  271.       }
  272.   
  273. ! #ifdef MULTI_BYTE
  274. !     screenp_to += char_bytes;
  275. !     screenp_from += char_bytes;
  276. !     col += char_bytes;
  277. ! #else
  278. !     ++screenp_to;
  279. !     ++screenp_from;
  280. !     ++col;
  281. ! #endif
  282.       }
  283.   
  284.       if (clear_rest
  285. --- 2116,2124 ----
  286.           }
  287.       }
  288.   
  289. !     screenp_to += CHAR_BYTES;
  290. !     screenp_from += CHAR_BYTES;
  291. !     col += CHAR_BYTES;
  292.       }
  293.   
  294.       if (clear_rest
  295. *** ../vim-5.6.59/src/version.c    Wed Apr  5 16:30:51 2000
  296. --- src/version.c    Wed Apr  5 16:31:16 2000
  297. ***************
  298. *** 420,421 ****
  299. --- 420,423 ----
  300.   {   /* Add new patch number below this line */
  301. + /**/
  302. +     60,
  303.   /**/
  304.  
  305. -- 
  306. SECOND SOLDIER: It could be carried by an African swallow!
  307. FIRST SOLDIER:  Oh  yes! An African swallow maybe ... but not a European
  308.                 swallow. that's my point.
  309.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  310.  
  311. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\
  312. \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
  313.