To: vim-dev@vim.org Subject: Patch 5.6.059 (extra) Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.059 (extra) Problem: When moving the cursor over italic text and the characters spill over to the cell on the right, that spill-over is deleted. Noticed in the Win32 GUI, can happen on other systems too. Solution: Redraw italic text starting from a blank, like this is already done for bold text. (Vince Negri) Files: src/gui.c, src/gui.h, src/gui_w32.c *** ../vim-5.6.58/src/gui.c Sat Mar 25 18:42:55 2000 --- src/gui.c Wed Apr 5 15:38:02 2000 *************** *** 1453,1462 **** --- 1453,1465 ---- gui_mch_set_font(font); #endif + draw_flags = 0; + /* Set the color */ bg_color = gui.back_pixel; if ((flags & GUI_MON_IS_CURSOR) && gui.in_focus) { + draw_flags |= DRAW_CURSOR; fg_color = fg; bg_color = bg; } *************** *** 1499,1511 **** if (!(flags & GUI_MON_NOCLEAR)) clip_may_clear_selection(gui.row, gui.row); - draw_flags = 0; /* If there's no bold font, then fake it */ if ((highlight_mask & (HL_BOLD | HL_STANDOUT)) && (gui.bold_font == 0 || (aep != NULL && aep->ae_u.gui.font != 0))) - { draw_flags |= DRAW_BOLD; s -= back; len += back; col -= back; --- 1502,1520 ---- if (!(flags & GUI_MON_NOCLEAR)) clip_may_clear_selection(gui.row, gui.row); /* If there's no bold font, then fake it */ if ((highlight_mask & (HL_BOLD | HL_STANDOUT)) && (gui.bold_font == 0 || (aep != NULL && aep->ae_u.gui.font != 0))) draw_flags |= DRAW_BOLD; + + /* + * When drawing bold or italic characters the spill-over from the left + * neighbor may be destroyed. Backup to start redrawing just after a + * blank. + */ + if ((draw_flags & DRAW_BOLD) || (highlight_mask & HL_ITALIC)) + { s -= back; len += back; col -= back; *** ../vim-5.6.58/src/gui.h Tue Jul 20 11:17:36 1999 --- src/gui.h Wed Apr 5 15:31:53 2000 *************** *** 139,144 **** --- 139,145 ---- #ifdef RISCOS # define DRAW_ITALIC 0x08 /* draw italic text */ #endif + #define DRAW_CURSOR 0x10 /* drawing block cursor (win32) */ /* For our own tearoff menu item */ #define TEAR_STRING "-->Detach" *** ../vim-5.6.58/src/gui_w32.c Wed Apr 5 10:05:34 2000 --- src/gui_w32.c Wed Apr 5 15:34:59 2000 *************** *** 3394,3399 **** --- 3394,3401 ---- { static int *padding = NULL; static int pad_size = 0; + const RECT *pcliprect = NULL; + UINT foptions = 0; #ifdef MULTI_BYTE static WCHAR *unicodebuf = NULL; #endif *************** *** 3448,3453 **** --- 3450,3465 ---- DeleteBrush(hbr); SetBkMode(s_hdc, TRANSPARENT); + + /* + * When drawing block cursor, prevent inverted character spilling + * over character cell (can happen with bold/italic) + */ + if (flags & DRAW_CURSOR) + { + pcliprect = &rc; + foptions = ETO_CLIPPED; + } } #else /* *************** *** 3484,3494 **** /* draw an incomplete composition character (korean) */ if (OrgLen == 1 && blink_state == BLINK_ON && (szComp = ImeGetTempComposition()) != NULL) // hangul ! HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL, szComp, ! 2, padding, TRUE); else ! HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL, (char *)s, ! len, padding, FALSE); } else #endif --- 3496,3506 ---- /* draw an incomplete composition character (korean) */ if (OrgLen == 1 && blink_state == BLINK_ON && (szComp = ImeGetTempComposition()) != NULL) // hangul ! HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), ! foptions, pcliprect, szComp, 2, padding, TRUE); else ! HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), ! foptions, pcliprect, (char *)s, len, padding, FALSE); } else #endif *************** *** 3507,3520 **** MB_PRECOMPOSED, (char *)s, len, (LPWSTR)unicodebuf, UNIBUFSIZE))) ! ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL, ! unicodebuf, len, NULL); } } else #endif ! ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL, ! (char *)s, len, padding); } if (flags & DRAW_UNDERL) --- 3519,3532 ---- MB_PRECOMPOSED, (char *)s, len, (LPWSTR)unicodebuf, UNIBUFSIZE))) ! ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), ! foptions, pcliprect, unicodebuf, len, NULL); } } else #endif ! ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), ! foptions, pcliprect, (char *)s, len, padding); } if (flags & DRAW_UNDERL) *** ../vim-5.6.58/src/version.c Wed Apr 5 14:42:03 2000 --- src/version.c Wed Apr 5 16:25:37 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 59, /**/ -- Clothes make the man. Naked people have little or no influence on society. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/