fix: selection in emacs/viins mode#911
Conversation
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for trying to tackle this (and not just doing the revert game) Haven't run it yet so I can't tell if the AI is doing slop here.
If it works I don't mind the use of it but maybe you could go through the tests and check which are truly necessary to cover the relevant bits and be explanatory, but we don't need too much redundant prose in the form of tests.
| // Default to Vi-style behavior for backward compatibility | ||
| self.get_selection_with_mode(&PromptEditMode::Vi(PromptViMode::Normal)) |
There was a problem hiding this comment.
Is there an explicit need to be backwards compatible here?
Maybe the correct thing would be to split it into true selection (which covers the characters in a consistent way with a range using indices used by the edit ops), and visual selection which is mode aware.
It seems the bug prone part was the visual selection, if there are no other users in reedline itself we should consider what the right behavior would be for a public user of get_selection (and if that is unlikely we can make things private.
fixes #893
A not-so-elegant solution coded by AI agent, just works according to my test.