Live gutter annotation is sometimes cleared
brownts opened this issue · 1 comments
Sometimes there are actions within Emacs that require git-gutter to clear and repaint the gutter. I noticed that when this happens, the gutter information corresponding to unsaved (i.e., live) changes will be cleared and not restored immediately. This happens because the updating of the live gutter information happens through git-gutter:live-update
which is triggered from the idle timer (i.e., via run-with-idle-timer
). When git-gutter:live-update
runs, it checks to see if the gutter should be updated. The main piece of information that is used to check this is the git-gutter:last-chars-modified-tick
which identifies the state of the buffer at the time of the last update. Thus, since the buffer didn't change (i.e., git-gutter:last-chars-modified-tick
hasn't changed) in the scenario described, no repainting of the live gutter annotation occurs. This leaves the gutter annotation for the unsaved edits cleared.
A simple example which demonstrates this issue is to increase the text scale: M-x text-scale-increase
. If there are unsaved edits, the gutter annotation for those unsaved edits will be cleared after running this command. This is because git-gutter is registered with the text-scale-mode-hook
and will clear and repaint the gutter when the text scale changes. However, it will only repaint the gutter information from the saved file. It does not automatically pick up the changes from the unsaved edits. As a workaround, any update to the buffer will cause the live gutter annotation to be repainted, but if no edit to the buffer occurs, the live gutter annotation will remain unpainted.
Any comments on merging the associated pull request?