added "keystroke a: insert after current position" action#712
Conversation
Support for keystroke "a", which maps into "insert after current position" was missing from handle_key_press function. Fixed adding the case using the Gdk.Key.i as example. closes elementary#614
| mode = Mode.INSERT; | ||
| view.move_cursor (Gtk.MovementStep.VISUAL_POSITIONS, 1, false); | ||
| debug ("Vim Emulation: INSERT Mode!"); | ||
| return true; |
There was a problem hiding this comment.
Why is this not implemented further down (where handling of Gdk.Key.A is implemented?
There was a problem hiding this comment.
It seemed to me that the cases where ordered alphabetically, so I applied the patch for Gdk.Key.a at the top (also Gdk.Key.i and Gdk.Key.I are not close)
There was a problem hiding this comment.
But Gdk.Key.A is processed in a different switch statement. The first one is related to setting the correct mode - not actions.
There was a problem hiding this comment.
Oh, I got it now. I'll update the patch
Previously, code was in a "change mode" section, while "a" keystroke is also a movement action, so moved closed to the "A" keystroke implementation (code review).
|
I am not a Vim user so could I confirm that the expected action is to start inserting text after the character that is on the right of the cursor? The effect of pressing |
|
Uhm, I was double checking the documentation to confirm, but while the usual use case is indeed "start inserting text after 1 character", it is possible to prefix the command with a number N, then the effect is to start inserting text after N characters. |
|
As far as I can tell, @mcclurgm 's implementation of the |
|
I see, could you give me some more time to see if a complete implementation is already doable? |
Allow to start editing after [count] character, being [count] a number typed just after pressing the "a" key.
|
It is possible :) |
|
Great! I'll remove this change from my PR then. |
|
@mcclurgm It is better to split into the smallest PRs that make sense to merge alone. Small focussed "bitesize" PRs are likely to get reviewed and merged much more quickly. |
|
Alright, I'll start working on that. Thanks for the suggestion! |
|
@mcclurgm Are you making any progress on splitting this? |
|
Not really sorry, I got a little stuck and then school started again. I'll try to get back on it. I did get one simple PR #737. |
|
I think you're right, I don't know why I was convinced it worked differently. However, this makes things way harder than expected, using a number code should
Do we want the full feature for |
|
I think that's correct. I think this may be doable using the It looks like this sort of behavior isn't accounted for in the code at all though. It would need some design to figure out how to make it reuse the buffer N times though, I'm not sure how that would fit in with the current code. Maybe we could make it check for a number when you press escape? |
|
I should look into this again, I don't even have Elementary installed anymore, sorry.
I can't follow, why checking for a number? |
|
Oh--sorry. When I said check for a number, I was thinking of the |
|
Yes, you are right, basically replying the last buffer for |
|
Maybe it makes sense to merge this as is, and then deal with the multiple-insert issue later once all the different insert options are in the codebase? |
|
It might sounds lazy, but I agree. At least the basic feature would be in and it's quite used |
jeremypw
left a comment
There was a problem hiding this comment.
No adverse effects found. <Esc>Na where N is a number moves the cursor N places to the right and enters insert mode. (Omission of N same as N = 1).
Support for keystroke "a", which VIM maps into "insert after current position", was missing from the
handle_key_pressfunction.Fixed adding the case using the
Gdk.Key.ias example.closes #614