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 / 6.1.341 < prev    next >
Encoding:
Internet Message Format  |  2003-02-16  |  6.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.341
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.341
  11. Problem:    In Insert mode with 'rightleft' set the cursor is drawn halfway a
  12.         double-wide character.  For CTRL-R and CTRL-K in Insert mode the "
  13.         or ? is not displayed.
  14. Solution:   Draw the cursor in the next character cell.  Display the " or ?
  15.         over the right half of the double-wide character. (Yasuhiro
  16.         Matsumoto)  Also fix that cancelling a digraph doesn't redraw
  17.         a double-byte character correctly.
  18. Files:        src/edit.c, src/gui.c, src/mbyte.c
  19.  
  20.  
  21. *** ../vim61.340/src/edit.c    Sun Feb 16 22:52:39 2003
  22. --- src/edit.c    Mon Feb 17 20:53:42 2003
  23. ***************
  24. *** 1359,1364 ****
  25. --- 1368,1376 ----
  26.    * Used while handling CTRL-K, CTRL-V, etc. in Insert mode.
  27.    */
  28.   static int  pc_char;
  29. + #define PC_CHAR_UNSET    0    /* pc_char was not set */
  30. + #define PC_CHAR_RIGHT    1    /* right halve of double-wide char */
  31. + #define PC_CHAR_LEFT    2    /* left halve of double-wide char */
  32.   static int  pc_attr;
  33.   static int  pc_row;
  34.   static int  pc_col;
  35. ***************
  36. *** 1379,1391 ****
  37.       else
  38.           attr = 0;
  39.       pc_row = W_WINROW(curwin) + curwin->w_wrow;
  40. !     pc_col = W_WINCOL(curwin) + (
  41.   #ifdef FEAT_RIGHTLEFT
  42. !         curwin->w_p_rl ? (int)W_WIDTH(curwin) - 1 - curwin->w_wcol :
  43.   #endif
  44. !                              curwin->w_wcol);
  45.       /* save the character to be able to put it back */
  46. !     pc_char = screen_getchar(pc_row, pc_col, &pc_attr);
  47.       screen_putchar(c, pc_row, pc_col, attr);
  48.       }
  49.   }
  50. --- 1391,1433 ----
  51.       else
  52.           attr = 0;
  53.       pc_row = W_WINROW(curwin) + curwin->w_wrow;
  54. !     pc_col = W_WINCOL(curwin);
  55. ! #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
  56. !     pc_char = PC_CHAR_UNSET;
  57. ! #endif
  58.   #ifdef FEAT_RIGHTLEFT
  59. !     if (curwin->w_p_rl)
  60. !     {
  61. !         pc_col += W_WIDTH(curwin) - 1 - curwin->w_wcol;
  62. ! # ifdef FEAT_MBYTE
  63. !         if (has_mbyte)
  64. !         {
  65. !         int fix_col = mb_fix_col(pc_col, pc_row);
  66. !         if (fix_col != pc_col)
  67. !         {
  68. !             screen_putchar(' ', pc_row, fix_col, attr);
  69. !             --curwin->w_wcol;
  70. !             pc_char = PC_CHAR_RIGHT;
  71. !         }
  72. !         }
  73. ! # endif
  74. !     }
  75. !     else
  76.   #endif
  77. !     {
  78. !         pc_col += curwin->w_wcol;
  79. ! #ifdef FEAT_MBYTE
  80. !         if (mb_lefthalve(pc_row, pc_col))
  81. !         pc_char = PC_CHAR_LEFT;
  82. ! #endif
  83. !     }
  84.       /* save the character to be able to put it back */
  85. ! #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
  86. !     if (pc_char == PC_CHAR_UNSET)
  87. ! #endif
  88. !         pc_char = screen_getchar(pc_row, pc_col, &pc_attr);
  89.       screen_putchar(c, pc_row, pc_col, attr);
  90.       }
  91.   }
  92. ***************
  93. *** 1396,1403 ****
  94.       void
  95.   edit_unputchar()
  96.   {
  97. !     if (pc_row >= msg_scrolled)
  98. !     screen_putchar(pc_char, pc_row - msg_scrolled, pc_col, pc_attr);
  99.   }
  100.   
  101.   /*
  102. --- 1438,1454 ----
  103.       void
  104.   edit_unputchar()
  105.   {
  106. !     if (pc_char != PC_CHAR_UNSET && pc_row >= msg_scrolled)
  107. !     {
  108. ! #if defined(FEAT_MBYTE)
  109. !     if (pc_char == PC_CHAR_RIGHT)
  110. !         ++curwin->w_wcol;
  111. !     if (pc_char == PC_CHAR_RIGHT || pc_char == PC_CHAR_LEFT)
  112. !         redrawWinline(curwin->w_cursor.lnum, FALSE);
  113. !     else
  114. ! #endif
  115. !         screen_putchar(pc_char, pc_row - msg_scrolled, pc_col, pc_attr);
  116. !     }
  117.   }
  118.   
  119.   /*
  120. ***************
  121. *** 5658,5663 ****
  122. --- 5709,5715 ----
  123.       /*
  124.        * If we are going to wait for a character, show a '"'.
  125.        */
  126. +     pc_char = PC_CHAR_UNSET;
  127.       if (redrawing() && !char_avail())
  128.       {
  129.       /* may need to redraw when no more chars available now */
  130. ***************
  131. *** 7104,7109 ****
  132. --- 7186,7192 ----
  133.       int        c;
  134.       int        cc;
  135.   
  136. +     pc_char = PC_CHAR_UNSET;
  137.       if (redrawing() && !char_avail())
  138.       {
  139.       /* may need to redraw when no more chars available now */
  140. ***************
  141. *** 7142,7148 ****
  142. --- 7225,7237 ----
  143.           ins_redraw();
  144.   
  145.           if (char2cells(c) == 1)
  146. +         {
  147. +         /* first remove the '?', otherwise it's restored when typing
  148. +          * an ESC next */
  149. +         edit_unputchar();
  150. +         ins_redraw();
  151.           edit_putchar(c, TRUE);
  152. +         }
  153.   #ifdef FEAT_CMDL_INFO
  154.           add_to_showcmd_c(c);
  155.   #endif
  156. *** ../vim61.340/src/gui.c    Sun Jan  5 13:32:45 2003
  157. --- src/gui.c    Mon Feb 17 19:51:56 2003
  158. ***************
  159. *** 948,953 ****
  160. --- 949,957 ----
  161.       }
  162.       else
  163.       {
  164. + #ifdef FEAT_MBYTE
  165. +         int        col_off = FALSE;
  166. + #endif
  167.           /*
  168.            * First draw the partial cursor, then overwrite with the text
  169.            * character, using a transparent background.
  170. ***************
  171. *** 963,974 ****
  172.           cur_height = (gui.char_height * shape_table[idx].percentage
  173.                                     + 99) / 100;
  174.           cur_width = gui.char_width;
  175.   #ifdef FEAT_MBYTE
  176. !         if ((*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1)
  177.               cur_width += gui.char_width;
  178. ! #endif
  179.           }
  180.           gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
  181.   
  182.   #ifndef FEAT_GUI_MSWIN        /* doesn't seem to work for MSWindows */
  183.           gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
  184. --- 967,993 ----
  185.           cur_height = (gui.char_height * shape_table[idx].percentage
  186.                                     + 99) / 100;
  187.           cur_width = gui.char_width;
  188. +         }
  189.   #ifdef FEAT_MBYTE
  190. !         if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1)
  191. !         {
  192. !         /* Double wide character. */
  193. !         if (shape_table[idx].shape != SHAPE_VER)
  194.               cur_width += gui.char_width;
  195. !         else if (!(State & CMDLINE) && curwin->w_p_rl)
  196. !         {
  197. !             /* gui.col points to the left halve of the character but
  198. !              * the vertical line needs to be on the right halve. */
  199. !             col_off = TRUE;
  200. !             ++gui.col;
  201. !         }
  202.           }
  203. + #endif
  204.           gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
  205. + #ifdef FEAT_MBYTE
  206. +         if (col_off)
  207. +         --gui.col;
  208. + #endif
  209.   
  210.   #ifndef FEAT_GUI_MSWIN        /* doesn't seem to work for MSWindows */
  211.           gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
  212. *** ../vim61.340/src/mbyte.c    Sun Feb 16 22:03:39 2003
  213. --- src/mbyte.c    Mon Feb 17 20:57:32 2003
  214. ***************
  215. *** 2300,2306 ****
  216.   }
  217.   #endif
  218.   
  219. ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(PROTO)
  220.   /*
  221.    * Correct a position on the screen, if it's the right halve of a double-wide
  222.    * char move it to the left halve.  Returns the corrected column.
  223. --- 2300,2307 ----
  224.   }
  225.   #endif
  226.   
  227. ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(FEAT_RIGHTLEFT) \
  228. !     || defined(PROTO)
  229.   /*
  230.    * Correct a position on the screen, if it's the right halve of a double-wide
  231.    * char move it to the left halve.  Returns the corrected column.
  232. *** ../vim61.340/src/version.c    Mon Feb 17 10:21:47 2003
  233. --- src/version.c    Mon Feb 17 20:59:10 2003
  234. ***************
  235. *** 608,609 ****
  236. --- 612,615 ----
  237.   {   /* Add new patch number below this line */
  238. + /**/
  239. +     341,
  240.   /**/
  241.  
  242. -- 
  243. Error:015 - Unable to exit Windows.  Try the door.
  244.  
  245.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  246. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  247. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  248.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  249.