You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 81798b4
Browse filesBrowse the repository at this point in the historyBrowse files
After a visual-block I, A or c, Escape applied the text to every row but
left Vim in insert mode (#803). CodeMirror runs every keymap from a single
DOM handler placed at the first keymap provider, and the editor mounts one
(markdown snippets) ahead of vim(), so every keymap binding sees a key
before the Vim plugin does. Two Escape bindings were spending it.
defaultKeymap binds Escape to simplifySelection, which reports the key
handled whenever there is more than one range or a non-empty one. Since
block edits became real multi-cursors (#792) that is exactly the state Vim
is in when Escape should end the edit: CodeMirror collapsed the cursors and
Vim never saw the key. The same binding made visual block need two presses,
and left a v or V selection through the selection listener with the cursor
on CodeMirror's head instead of the character Vim keeps it on. Escape now
defers to Vim in insert, replace and visual mode. Normal mode keeps the
native command, because there Vim itself hands Escape back to the editor so
stray extra cursors can still collapse.
The completion keymap's closeCompletion reports the key handled while any
source is merely pending, and every typed character puts all sources into
that state for the activateOnTyping debounce (about 100ms) even when none
will match. An Escape pressed right after the last character was lost to a
completion nobody could see, with a single cursor too: easy to hit with
Escape on Caps Lock, and what kept a block insert stuck for fast typists
even once the first binding was out of the way. A pending query is still
cancelled, but only a visible popup keeps the key. A visible popup still
takes the first Escape and stays in insert mode, as before.
The #792 suite asserted a return to normal mode and passed falsely: it
mounted vim() ahead of any keymap, the reverse of the app, so Vim got
Escape first. The mount now mirrors the app's handler order, and with the
fix removed nine tests fail.
Fixes#803.
0 commit comments