Skip to content

Commit c49cfdc

Browse files
committed
Make sure global escape still works in Vim mode
1 parent 2cea001 commit c49cfdc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

novelwriter/gui/doceditor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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
##

novelwriter/guimain.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)