Closed rocher closed 8 years ago
Seems git-gutter+ already has function git-gutter+-show-hunk
.
Thanks, Francesc!
Could you explain how your new function improves the existing function git-gutter+-show-hunk-at-point
?
@nonsequitur I cannot find the existing function git-gutter+-show-hunk-at-point
you mentioned. The only I've found is git-gutter+-show-hunk
, which "Show hunk at point in another window".
My proposed new function git-gutter+-show-hunk-at-point
is quite similar to the existing one, with the difference that the hunk is momentarily displayed not in another window, but near to the current point.
Anyone tried this new function?
@rocher I tested this function, I like this way. great idea to show diff in this way. Hope will be merged.
@stardiviner Thanks for your feedback. Hope will be merged too!
@rocher I've cleaned up the code a bit. Currently, it's here in a temp branch.
What's the reason for the final (discard-input)
? Is it really needed?
@nonsequitur Nice job, really!
The final (discard-input)
is probably not needed. When momentary-string-display
is inside a loop and a key is held pressed down for a long time, then there is a high probability that, after the loop finishes, some input characters are still in the queue waiting to be processed by momentary-string-display
, so its better to discard them. As there is no loop, I think it can be safely removed.
seems not merged yet, I found git-gutter+-awhen
in @rocher's code example is void now.
I've been using it for many times, is there another function to replace it temporary? @nonsequitur
@stardiviner The function has been renamed to git-gutter+-show-hunk-inline-at-point
.
Please find here a new function to show hunk at point 'at point', very useful for short changes involving few lines. The hunk is shown momentarily: press any key and it disappears. It is possible to take actions depending on the key pressed. For example, it would be possible to revert the hunk or to commit it. Currently this key is just discarded.
Hope you like it ! -- Francesc Rocher