From 65780b1896a71becc0d9ea6edff59f06dff25e87 Mon Sep 17 00:00:00 2001 From: Sean Yeh Date: Mon, 22 Dec 2014 17:36:54 -0600 Subject: [PATCH] Allow arrow keys in Normal mode and move some code to KeyReleased --- src/vibreoffice.vbs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/vibreoffice.vbs b/src/vibreoffice.vbs index 926d0de..4d3e790 100644 --- a/src/vibreoffice.vbs +++ b/src/vibreoffice.vbs @@ -229,12 +229,13 @@ function KeyHandler_KeyPressed(oEvent) as boolean Exit Function End If - dim bConsumeInput, bIsMultiplier, bIsModified, bIsSpecial, oTextCursor + dim bConsumeInput, bIsMultiplier, bIsModified, bIsSpecial bConsumeInput = True ' Block all inputs by default bIsMultiplier = False ' reset multiplier by default bIsModified = oEvent.Modifiers > 1 ' If Ctrl or Alt is held down. (Shift=1) bIsSpecial = getSpecial() <> "" + ' -------------------------- ' Process global shortcuts, exit if matched (like ESC) If ProcessGlobalKey(oEvent) Then @@ -273,10 +274,13 @@ function KeyHandler_KeyPressed(oEvent) as boolean ElseIf ProcessMovementModifierKey(oEvent.KeyChar) Then delaySpecialReset() - ' If bIsSpecial but nothing matched, return to normal mode ElseIf bIsSpecial Then gotoMode("NORMAL") + + ' Allow non-letter keys if unmatched + ElseIf asc(oEvent.KeyChar) = 0 Then + bConsumeInput = False End If ' -------------------------- @@ -289,6 +293,12 @@ function KeyHandler_KeyPressed(oEvent) as boolean End If setStatus(getMultiplier()) + KeyHandler_KeyPressed = bConsumeInput +End Function + +Function KeyHandler_KeyReleased(oEvent) As boolean + dim oTextCursor + ' Show terminal-like cursor oTextCursor = getTextCursor() If oEvent.Modifiers = 2 Or oEvent.Modifiers = 8 And oEvent.KeyChar = "c" Then @@ -301,10 +311,6 @@ function KeyHandler_KeyPressed(oEvent) as boolean thisComponent.getCurrentController.Select(oTextCursor) End If - KeyHandler_KeyPressed = bConsumeInput -End Function - -Function KeyHandler_KeyReleased(oEvent) As boolean KeyHandler_KeyReleased = (MODE = "NORMAL") 'cancel KeyReleased End Function