airblade/vim-gitgutter

GitGutterUndoHunk: after that I see the same ~ but jumped after the next line

vitaly-zdanevich opened this issue · 12 comments

Before:

  >--->---TrItemsParams: TrItemsParams{$
  >--->--->---TrItemParams{$
  >--->--->--->---TransferID:           "at_1",$
  >--->--->--->---Barcode:              "5057107950450",$
  >--->--->--->---AllocatedQuantity:    10,$
  >--->--->--->---PickExceptedQuantity: 0,$
  >--->--->--->---ShippedQuantity:      10,$                                                                                                                               
  >--->--->--->---ReceivedQuantity:     0,$
~ >--->--->--->---Status:               models.ShipmentEventTypeCOMPLETE,$
  >--->--->---},$
  >--->--->---TrItemParams{$
  >--->--->--->---TransferID:           "at_1",$
  >--->--->--->---Barcode:              "5057110120932",$
  >--->--->--->---AllocatedQuantity:    8,$
  >--->--->--->---PickExceptedQuantity: 0,$
  >--->--->--->---ShippedQuantity:      5,$

After:

  >--->---TrItemsParams: TrItemsParams{$
  >--->--->---TrItemParams{$
  >--->--->--->---TransferID:           "at_1",$
  >--->--->--->---Barcode:              "5057107950450",$
  >--->--->--->---AllocatedQuantity:    10,$
  >--->--->--->---PickExceptedQuantity: 0,$
  >--->--->--->---ShippedQuantity:      10,$
  >--->--->--->---ReceivedQuantity:     0,$
  >--->--->--->---Status:               models.ShipmentEventTypeSHIPPED,$
  >--->--->---},$                                                                                                                                                          
~ >--->--->---TrItemParams{$
  >--->--->--->---TransferID:           "at_1",$
  >--->--->--->---Barcode:              "5057110120932",$
  >--->--->--->---AllocatedQuantity:    8,$
  >--->--->--->---PickExceptedQuantity: 0,$
  >--->--->--->---ShippedQuantity:      5,$

~ disappear after I move my mouse to another display and return back.

What is the latest commit SHA in your installed vim-gitgutter?

00df108


:version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jan 26 2023 14:06:02)
Included patches: 1-1000
Modified by Gentoo-9.0.1000
Compiled by portage@localhost
Huge version without GUI.  Features included (+) or not (-):
+acl               +cmdline_hist      +ex_extra          +jumplist          +mouse_dec         -perl              +sodium            +textobjects       +wildmenu
+arabic            +cmdline_info      +extra_search      +keymap            -mouse_gpm         +persistent_undo   -sound             +textprop          +windows
+autocmd           +comments          -farsi             +lambda            -mouse_jsbterm     +popupwin          +spell             +timers            +writebackup
+autochdir         +conceal           +file_in_path      +langmap           +mouse_netterm     +postscript        +startuptime       +title             +X11
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +statusline        -toolbar           +xfontset
-balloon_eval      -cscope            +float             +linebreak         -mouse_sysmouse    +profile           -sun_workshop      +user_commands     -xim
+balloon_eval_term +cursorbind        +folding           +lispindent        +mouse_urxvt       -python            +syntax            +vartabs           -xpm
-browse            +cursorshape       -footer            +listcmds          +mouse_xterm       -python3           +tag_binary        +vertsplit         +xsmp_interact
++builtin_terms    +dialog_con        +fork()            +localmap          +multi_byte        +quickfix          -tag_old_static    +vim9script        +xterm_clipboard
+byte_offset       +diff              +gettext           -lua               +multi_lang        +reltime           -tag_any_white     +viminfo           -xterm_save
+channel           +digraphs          -hangul_input      +menu              -mzscheme          +rightleft         -tcl               +virtualedit
+cindent           -dnd               +iconv             +mksession         +netbeans_intg     -ruby              +termguicolors     +visual
+clientserver      -ebcdic            +insert_expand     +modify_fname      +num64             +scrollbind        -terminal          +visualextra
+clipboard         +emacs_tags        +ipv6              +mouse             +packages          +signs             +terminfo          +vreplace
+cmdline_compl     +eval              +job               -mouseshape        +path_extra        +smartindent       +termresponse      +wildignore
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -march=native -pipe -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -L/usr/local/lib -o vim -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lsodium -lacl -lattr

Are you saying that after GitGutterUndoHunk:

  • the hunk is correctly undone;
  • but the ~ sign is still there and has moved two lines down;
  • moving focus to another window and then back again makes the ~ disappear (but doesn't change the buffer)?

Are you saying that after GitGutterUndoHunk:

Yes.

but doesn't change the buffer?

No changes to the buffer, but I want to remove ~ after GitGutterUndoHunk :(

This is something on my side?

I suspect you have a default updatetime, or it has a value of a few thousand (milliseconds) or more.

GitGutterUndoHunk updates the buffer's contents as appropriate but doesn't do anything with the signs. The signs are refreshed when gitgutter's CursorHold autocommand next fires.

My updatetime is 100 which is why I never noticed this before.

It makes sense for updating the signs to be part of the hunk commands so I'll update the code to do that.

The code was already updating the signs are staging a hunk; it looks like I simply forgot to do that after undoing a hunk.

Thanks for letting me know about this.

Thanks, this problem is solved!

But another one:

  1. GitGutterUndoHunk
  2. Undo (it add my changes back)
  3. :w
  4. No ~ added :(, again only after mouse to another window and back.

I can't reproduce that.

What does :verbose set updatetime produce?

Oh, yes, ~ is added back after 4 seconds...

So the ~ will vanish after 4 seconds.

I recommend setting updatetime to something much lower, e.g. 100.

Please see the first paragraph of Getting started in the readme :)

Oh, I see, 4000 is the default number in Vim...

GitGutter doesn't pay any attention to if / when you save a file. It's triggered by CursorHold(I) (and when you change to a different buffer or focus the window etc).