File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -581,6 +581,12 @@ def updateDocMargins(self) -> None:
581581 lM = max (self ._vpMargin , fH )
582582 self .setViewportMargins (tM , uM , tM , lM )
583583
584+ def isVimEscapable (self ) -> bool :
585+ """Check if Escape keypress should be processed for Vim mode."""
586+ if CONFIG .vimMode and self ._vim .mode != nwVimMode .NORMAL :
587+ return True
588+ return False
589+
584590 ##
585591 # Getters
586592 ##
Original file line number Diff line number Diff line change @@ -1274,12 +1274,10 @@ def _keyPressReturn(self) -> None:
12741274 @pyqtSlot ()
12751275 def _keyPressEscape (self ) -> None :
12761276 """Process an escape keypress in the main window."""
1277- if CONFIG .vimMode :
1278- self .docEditor .setVimMode (nwVimMode .NORMAL )
1279- return
1280-
12811277 if self .docEditor .searchVisible ():
12821278 self .docEditor .closeSearch ()
1279+ elif self .docEditor .isVimEscapable ():
1280+ self .docEditor .setVimMode (nwVimMode .NORMAL )
12831281 elif SHARED .focusMode :
12841282 SHARED .setFocusMode (False )
12851283
You can’t perform that action at this time.
0 commit comments