Clear RBUFFER when accepting output from atuin #545
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since we pass $BUFFER to atuin search, retaining RBUFFER (the part of the buffer to the right of the cursor) on accepting a history replacement probably doesn't make sense. The advantage of setting RBUFFER and LBUFFER separately instead of setting BUFFER is that the cursor is positioned after the end of LBUFFER instead of remaining where it was before atuin was called.
Alternatively, _atuin_search() could pass $LBUFFER to atuin instead of $BUFFER which would allow the widget to replace parts of command lines (such as the initial parts of a shell pipeline), but I would prefer the default to replace the whole command line from the history.
A widget that only replaces parts of command lines could be added separately if there's interest in it, though users could always just add it themselves (I'm not sure how many users would want such a feature).