From dc5396d1dca388a52a7b43d7bba6717786a30164 Mon Sep 17 00:00:00 2001 From: fox0430 Date: Thu, 5 Aug 2021 18:36:46 +0900 Subject: [PATCH 1/2] Visual mode: Fix enter insert mode command --- src/moepkg/visualmode.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/moepkg/visualmode.nim b/src/moepkg/visualmode.nim index 7bc3200c1..8deba3907 100644 --- a/src/moepkg/visualmode.nim +++ b/src/moepkg/visualmode.nim @@ -438,6 +438,8 @@ proc insertCharBlock(bufStatus: var BufferStatus, windowNode.currentLine = beforeLine proc visualCommand(status: var EditorStatus, area: var SelectArea, key: Rune) = + exitUi() + echo key area.swapSelectArea if key == ord('y') or isDcKey(key): @@ -608,9 +610,6 @@ proc visualMode*(status: var EditorStatus) = elif key == ord('g'): if getKey(currentMainWindowNode) == ord('g'): moveToFirstLine(status) - elif key == ord('i'): - if currentBufStatus.isReadonly: - status.commandLine.writeReadonlyModeWarning else: currentMainWindowNode.currentLine = currentBufStatus.selectArea.startLine status.changeMode(Mode.insert) @@ -619,5 +618,8 @@ proc visualMode*(status: var EditorStatus) = status.visualBlockCommand(currentBufStatus.selectArea, key) else: status.visualCommand(currentBufStatus.selectArea, key) + status.update - status.changeMode(Mode.normal) + + if isNormalMode(currentBufStatus.mode, currentBufStatus.prevMode): + status.changeMode(Mode.normal) From 067b3cdd740279961d16514723497251f34ed95c Mon Sep 17 00:00:00 2001 From: fox0430 Date: Thu, 5 Aug 2021 18:37:26 +0900 Subject: [PATCH 2/2] Delete unnecessary echo --- src/moepkg/visualmode.nim | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/moepkg/visualmode.nim b/src/moepkg/visualmode.nim index 8deba3907..b52353434 100644 --- a/src/moepkg/visualmode.nim +++ b/src/moepkg/visualmode.nim @@ -438,8 +438,6 @@ proc insertCharBlock(bufStatus: var BufferStatus, windowNode.currentLine = beforeLine proc visualCommand(status: var EditorStatus, area: var SelectArea, key: Rune) = - exitUi() - echo key area.swapSelectArea if key == ord('y') or isDcKey(key):