home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.1.341
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.1.341
- Problem: In Insert mode with 'rightleft' set the cursor is drawn halfway a
- double-wide character. For CTRL-R and CTRL-K in Insert mode the "
- or ? is not displayed.
- Solution: Draw the cursor in the next character cell. Display the " or ?
- over the right half of the double-wide character. (Yasuhiro
- Matsumoto) Also fix that cancelling a digraph doesn't redraw
- a double-byte character correctly.
- Files: src/edit.c, src/gui.c, src/mbyte.c
-
-
- *** ../vim61.340/src/edit.c Sun Feb 16 22:52:39 2003
- --- src/edit.c Mon Feb 17 20:53:42 2003
- ***************
- *** 1359,1364 ****
- --- 1368,1376 ----
- * Used while handling CTRL-K, CTRL-V, etc. in Insert mode.
- */
- static int pc_char;
- + #define PC_CHAR_UNSET 0 /* pc_char was not set */
- + #define PC_CHAR_RIGHT 1 /* right halve of double-wide char */
- + #define PC_CHAR_LEFT 2 /* left halve of double-wide char */
- static int pc_attr;
- static int pc_row;
- static int pc_col;
- ***************
- *** 1379,1391 ****
- else
- attr = 0;
- pc_row = W_WINROW(curwin) + curwin->w_wrow;
- ! pc_col = W_WINCOL(curwin) + (
- #ifdef FEAT_RIGHTLEFT
- ! curwin->w_p_rl ? (int)W_WIDTH(curwin) - 1 - curwin->w_wcol :
- #endif
- ! curwin->w_wcol);
- /* save the character to be able to put it back */
- ! pc_char = screen_getchar(pc_row, pc_col, &pc_attr);
- screen_putchar(c, pc_row, pc_col, attr);
- }
- }
- --- 1391,1433 ----
- else
- attr = 0;
- pc_row = W_WINROW(curwin) + curwin->w_wrow;
- ! pc_col = W_WINCOL(curwin);
- ! #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
- ! pc_char = PC_CHAR_UNSET;
- ! #endif
- #ifdef FEAT_RIGHTLEFT
- ! if (curwin->w_p_rl)
- ! {
- ! pc_col += W_WIDTH(curwin) - 1 - curwin->w_wcol;
- ! # ifdef FEAT_MBYTE
- ! if (has_mbyte)
- ! {
- ! int fix_col = mb_fix_col(pc_col, pc_row);
- !
- ! if (fix_col != pc_col)
- ! {
- ! screen_putchar(' ', pc_row, fix_col, attr);
- ! --curwin->w_wcol;
- ! pc_char = PC_CHAR_RIGHT;
- ! }
- ! }
- ! # endif
- ! }
- ! else
- #endif
- ! {
- ! pc_col += curwin->w_wcol;
- ! #ifdef FEAT_MBYTE
- ! if (mb_lefthalve(pc_row, pc_col))
- ! pc_char = PC_CHAR_LEFT;
- ! #endif
- ! }
- !
- /* save the character to be able to put it back */
- ! #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
- ! if (pc_char == PC_CHAR_UNSET)
- ! #endif
- ! pc_char = screen_getchar(pc_row, pc_col, &pc_attr);
- screen_putchar(c, pc_row, pc_col, attr);
- }
- }
- ***************
- *** 1396,1403 ****
- void
- edit_unputchar()
- {
- ! if (pc_row >= msg_scrolled)
- ! screen_putchar(pc_char, pc_row - msg_scrolled, pc_col, pc_attr);
- }
-
- /*
- --- 1438,1454 ----
- void
- edit_unputchar()
- {
- ! if (pc_char != PC_CHAR_UNSET && pc_row >= msg_scrolled)
- ! {
- ! #if defined(FEAT_MBYTE)
- ! if (pc_char == PC_CHAR_RIGHT)
- ! ++curwin->w_wcol;
- ! if (pc_char == PC_CHAR_RIGHT || pc_char == PC_CHAR_LEFT)
- ! redrawWinline(curwin->w_cursor.lnum, FALSE);
- ! else
- ! #endif
- ! screen_putchar(pc_char, pc_row - msg_scrolled, pc_col, pc_attr);
- ! }
- }
-
- /*
- ***************
- *** 5658,5663 ****
- --- 5709,5715 ----
- /*
- * If we are going to wait for a character, show a '"'.
- */
- + pc_char = PC_CHAR_UNSET;
- if (redrawing() && !char_avail())
- {
- /* may need to redraw when no more chars available now */
- ***************
- *** 7104,7109 ****
- --- 7186,7192 ----
- int c;
- int cc;
-
- + pc_char = PC_CHAR_UNSET;
- if (redrawing() && !char_avail())
- {
- /* may need to redraw when no more chars available now */
- ***************
- *** 7142,7148 ****
- --- 7225,7237 ----
- ins_redraw();
-
- if (char2cells(c) == 1)
- + {
- + /* first remove the '?', otherwise it's restored when typing
- + * an ESC next */
- + edit_unputchar();
- + ins_redraw();
- edit_putchar(c, TRUE);
- + }
- #ifdef FEAT_CMDL_INFO
- add_to_showcmd_c(c);
- #endif
- *** ../vim61.340/src/gui.c Sun Jan 5 13:32:45 2003
- --- src/gui.c Mon Feb 17 19:51:56 2003
- ***************
- *** 948,953 ****
- --- 949,957 ----
- }
- else
- {
- + #ifdef FEAT_MBYTE
- + int col_off = FALSE;
- + #endif
- /*
- * First draw the partial cursor, then overwrite with the text
- * character, using a transparent background.
- ***************
- *** 963,974 ****
- cur_height = (gui.char_height * shape_table[idx].percentage
- + 99) / 100;
- cur_width = gui.char_width;
- #ifdef FEAT_MBYTE
- ! if ((*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1)
- cur_width += gui.char_width;
- ! #endif
- }
- gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
-
- #ifndef FEAT_GUI_MSWIN /* doesn't seem to work for MSWindows */
- gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
- --- 967,993 ----
- cur_height = (gui.char_height * shape_table[idx].percentage
- + 99) / 100;
- cur_width = gui.char_width;
- + }
- #ifdef FEAT_MBYTE
- ! if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1)
- ! {
- ! /* Double wide character. */
- ! if (shape_table[idx].shape != SHAPE_VER)
- cur_width += gui.char_width;
- ! else if (!(State & CMDLINE) && curwin->w_p_rl)
- ! {
- ! /* gui.col points to the left halve of the character but
- ! * the vertical line needs to be on the right halve. */
- ! col_off = TRUE;
- ! ++gui.col;
- ! }
- }
- + #endif
- gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
- + #ifdef FEAT_MBYTE
- + if (col_off)
- + --gui.col;
- + #endif
-
- #ifndef FEAT_GUI_MSWIN /* doesn't seem to work for MSWindows */
- gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
- *** ../vim61.340/src/mbyte.c Sun Feb 16 22:03:39 2003
- --- src/mbyte.c Mon Feb 17 20:57:32 2003
- ***************
- *** 2300,2306 ****
- }
- #endif
-
- ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(PROTO)
- /*
- * Correct a position on the screen, if it's the right halve of a double-wide
- * char move it to the left halve. Returns the corrected column.
- --- 2300,2307 ----
- }
- #endif
-
- ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(FEAT_RIGHTLEFT) \
- ! || defined(PROTO)
- /*
- * Correct a position on the screen, if it's the right halve of a double-wide
- * char move it to the left halve. Returns the corrected column.
- *** ../vim61.340/src/version.c Mon Feb 17 10:21:47 2003
- --- src/version.c Mon Feb 17 20:59:10 2003
- ***************
- *** 608,609 ****
- --- 612,615 ----
- { /* Add new patch number below this line */
- + /**/
- + 341,
- /**/
-
- --
- Error:015 - Unable to exit Windows. Try the door.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
- \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
- \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
-