sainnhe / gruvbox-material

Gruvbox with Material Palette
MIT License
1.97k stars 166 forks source link

Changed words are hard to read when highlighted in diff view #53

Closed moetayuko closed 4 years ago

moetayuko commented 4 years ago
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 17 2020 21:54:53)
包含补丁: 1-1704
编译者 Arch Linux
巨型版本 with GTK3 GUI.  可使用(+)与不可使用(-)的功能:
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl/dyn
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl/dyn          +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           +ruby/dyn          +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
     系统 vimrc 文件: "/etc/vimrc"
     用户 vimrc 文件: "$HOME/.vimrc"
 第二用户 vimrc 文件: "~/.vim/vimrc"
      用户 exrc 文件: "$HOME/.exrc"
    系统 gvimrc 文件: "/etc/gvimrc"
    用户 gvimrc 文件: "$HOME/.gvimrc"
第二用户 gvimrc 文件: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
        系统菜单文件: "$VIMRUNTIME/menu.vim"
         $VIM 预设值: "/usr/share/vim"
编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
链接方式: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm

Steps to reproduce this bug using minimal vimrc

  1. vimdiff 2 random files
  2. :set cursorline
  3. Move to a line with different contents

Actual behaviour

image

Expected behaviour

The words are readable

moetayuko commented 4 years ago

@sainnhe Thanks for the fix, but highlighted words became indistinguishable again after https://github.com/sainnhe/gruvbox-material/commit/33adda2c86f92fa8d41cf80f3291a425e834be1f

I use coc-highlight to highlight the symbol under the cursor, in the following cases false are highlighted.

w/o https://github.com/sainnhe/gruvbox-material/commit/33adda2c86f92fa8d41cf80f3291a425e834be1f

image

w/ https://github.com/sainnhe/gruvbox-material/commit/33adda2c86f92fa8d41cf80f3291a425e834be1f

image

sainnhe commented 4 years ago

Should be fixed via 5797fe8.

moetayuko commented 4 years ago

Should be fixed via 5797fe8.

Fixed now, thanks for the update.

moetayuko commented 3 years ago

@sainnhe Just noticed that the implementation is problematic, the blocks guarded with if &diff only get applied on vim start, as a result, they only take effect when vim is launched with vimdiff a.txt b.txt, but not when toggling diff mode with :diffthis in a normal vim instance.

Concreately, https://github.com/sainnhe/gruvbox-material/commit/db6d465d06f5927b571bddc7d715e7d3caba49c3 and https://github.com/sainnhe/gruvbox-material/commit/5797fe8721b396cdd84dc4b2575532c192c4b98f don't get applied in the 2nd case.

sainnhe commented 3 years ago

Is there any event for this command? If so, we can add a autocmd to reload this color scheme.

I'm not sure about this. PR is welcome.