Weird underline highlight problem in vim-cocoa

13 views
Skip to first unread message

Jjgod Jiang

unread,
May 24, 2008, 2:06:39 PM5/24/08
to vim...@googlegroups.com, vim...@googlegroups.com, br...@moolenaar.net
Hi folks,

Recently I observed a weird problem in vim-cocoa when doing syntax
highlighting, however after some debugging, I discovered that's not
related to the GUI code.

The problem is, if a :highlight rule contains "gui=italic", then it
will be interpreted as underline (HL_UNDERLINE) rather than italic,
resulting the GUI part drawing underlined string instead of italic
ones.

The tricky thing is, I only observed this in vim-cocoa, MacVim doesn't
have this problem -- but I could see the differences between their
code in relevant part.

vim-cocoa does load the highlight rule correctly, which can be
confirmed by typing :highlight <rule-name>, it does show "gui=italic"
just like MacVim, but then emitting strings for drawing in ui_write(),
the attribute contains HL_UNDERLINE, that's the part I really can't
find out why.

Here are two screenshots to demonstrate this briefly (note the highlight
of comment):

http://jjgod.org/document/images/vim-cocoa-highlight.png
http://jjgod.org/document/images/macvim-highlight.png

So here I'm looking for further advices, is there any other
configuration may affect this behavior? Thanks.

- Jiang

björn

unread,
May 24, 2008, 4:49:06 PM5/24/08
to vim...@googlegroups.com, vim...@googlegroups.com
2008/5/24 Jjgod Jiang <gzj...@gmail.com>:

Hi Jiang,

This is a guess, but could it be that you need to add FEAT_GUI_COCOA
(?) to the following lines in gui.c (starting at line 2246)? Note
that this is taken from the MacVim's gui.c so line numbers may differ
and obviously the FEAT_GUI_MACVIM isn't in the original gui.c.

Björn


#if defined(RISCOS) || defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)
/* If there's no italic font, then fake it.
* For GTK2, we don't need a different font for italic style. */
if (hl_mask_todo & HL_ITALIC)
draw_flags |= DRAW_ITALIC;

/* Do we underline the text? */
if (hl_mask_todo & HL_UNDERLINE)
draw_flags |= DRAW_UNDERL;
#else
/* Do we underline the text? */
if ((hl_mask_todo & HL_UNDERLINE)
# ifndef MSWIN16_FASTTEXT
|| (hl_mask_todo & HL_ITALIC)
# endif
)
draw_flags |= DRAW_UNDERL;
#endif

Jjgod Jiang

unread,
May 24, 2008, 11:57:50 PM5/24/08
to vim...@googlegroups.com, vim...@googlegroups.com
Hi,

On Sun, May 25, 2008 at 4:49 AM, björn <bjorn.w...@gmail.com> wrote:
> Hi Jiang,
>
> This is a guess, but could it be that you need to add FEAT_GUI_COCOA
> (?) to the following lines in gui.c (starting at line 2246)? Note
> that this is taken from the MacVim's gui.c so line numbers may differ
> and obviously the FEAT_GUI_MACVIM isn't in the original gui.c.

Thanks Björn, that's exactly the reason! I missed the
# ifndef MSWIN16_FASTTEXT
part when I first debugging that.

- Jiang

Reply all
Reply to author
Forward
0 new messages