Highlight only applies to actions which add content back to the buffer
mcauley-penney opened this issue · 9 comments
When undoing or redoing, it seems that highlights are only applied when content is added. I don't know if this is the intended behavior (so I can't label this as a bug or feature request) but it is different than the behavior of the original, deno-based plugin that this plugin intends to rewrite in Lua. If this behavior is not reproducible, I'll bisect my configuration and try and see where it comes from.
I can repro. The issue seems to be there.
I don't know how the deno plugin works, but if you think about it, how would you highlight non-addition changes? There would be nothing to highlight...
Currently, the plugin interfaces the on_bytes callback of nvim_buf_attach. If you can describe the behaviour you are looking for, and it is supported by the on_bytes callback, lets try to implement it.
Also, looking at the attached gif, you are adding empty lines. What would there be to highlight??
Maybe an indication in the sign column would be more appropriate in this case, as there is nothing to highlight in the buffer itself.
the only way I can think to implement this would be, when the user presses 'u', it triggers the highlight, and after the animation ends, the undo hapens.
You would have to trigger it like this:
- undo
- redo
- capture the changed bytes, highlight them
- insert some sort of delay
- undo again
not sure its worth it, and would also make undo not instantaneous.
but if you think about it, how would you highlight non-addition changes? There would be nothing to highlight...
the only way I can think to implement this would be, when the user presses 'u', it triggers the highlight, and after the animation ends, the undo hapens.
not sure its worth it, and would also make undo not instantaneous.
This is the way the deno version works, but I agree that it may not be worth it and that the change in speed could be irritating. The consistency of always having the highlight around to indicate changes is a plus, but I don't know how big of a plus. Either way, I incorrectly assumed that duplicating the functionality of the original was a goal, but I should not have.
I also think it would be annoying.
Will consider a PR though, properly fenced behind a setting....
It would be cool giving it a shot. It is the name of the package after all.
Undo can also be additive....