Restore document state on completion cancel - #2096
Conversation
9f0e78b to
109d7cf
Compare
|
|
||
| impl Component for Completion { | ||
| fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult { | ||
| // let the Editor handle Esc instead |
There was a problem hiding this comment.
This override was meaningful though: we wanted esc to both cancel completion and leave insert mode.
There was a problem hiding this comment.
Yes, that's true. I am suggesting that change and I have explanations. First of all I would like to mention that it is same how vim and other modal editors works. Second it is very (by my opinion, of course) annoying and unexpected when you press escape(mostly a reflex) to unwanted completion window to continue input you got normal mode and you need to get back to insert mode again(I know about ctrl-c, but escape is so obvious). I thing we should ask about it in matrix and summarize more opinions. If you think it is principal I can split that PR ?
There was a problem hiding this comment.
The behavior was intentional: it's even more annoying when you're typing code in insert mode, you try to exit insert mode but during that time the auto-completion popup appeared. You cancel the auto-completion and start typing normal mode commands but these result in text edits.
Ctrl-c is already available as a way to close the completion popup without exiting insert mode. Esc is a way to exit insert mode and clearing the completion is a side effect.
109d7cf to
469fa3b
Compare
Restoring document state after completion cancel.