macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.56k stars 682 forks source link

Broken ligatures with `set colorcolumn` #159

Open afgomez opened 9 years ago

afgomez commented 9 years ago

When writing a character with a ligature in a column with a painted colorcolumn the ligature doesn't show.

You can see it in the screenshot. The first !== shows the correct ligature, but the second shows the actual characters.

screen shot 2015-11-30 at 16 25 52

This happens in latest stable build from homebrew

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 18 2015 10:58:07)
MacOS X (unix) version
Included patches: 1-922
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_binary
+arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
+autocmd         +float           +mouse_urxvt     -tag_any_white
+balloon_eval    +folding         +mouse_xterm     +tcl
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +fullscreen      -mzscheme        +textobjects
+cindent         -gettext         +netbeans_intg   +title
+clientserver    -hangul_input    +odbeditor       +toolbar
+clipboard       +iconv           +path_extra      +transparency
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -framework CoreFoundation -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa  -pagezero_size 10000 -image_base 100000000 -L/usr/local/lib -lluajit-5.1 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby
splhack commented 8 years ago

7.4.949 might change the behavior. Could you check the master branch?

afgomez commented 8 years ago

It's still happening with the version from HEAD

$ mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  4 2015 10:11:43)
MacOS X (unix) version
Included patches: 1-960
...
HealsCodes commented 8 years ago

Since I'm more or less responsible for the current ligature support I think I know what's going on here. As the colorcolumn is rendered with a different background the renderer will probably do a drawString for the single '! ' and then a second for the remaining characters '=='. In that case the ligature can't be detected properly (for detection all characters forming a ligature have to be drawn in the same drawString).

stevenharman commented 7 years ago

@Shirk It's been... a while, but any thoughts on whether or not there might be a fix (or way forward) for this issue? Granted, it's not huge, but it is pretty distracting for anyone using a font with ligature support.

Thanks for all of the work!

eirnym commented 6 years ago

@stevenharman Could you draw what do you expect in colors? This would help developers to make a patch