#20: fix arrow, home, end keys in visual mode

This commit is contained in:
Sean Yeh 2015-05-29 19:12:26 -05:00
parent 9a85b6056d
commit 6277db2c2b
1 changed files with 33 additions and 0 deletions

View File

@ -274,6 +274,10 @@ function KeyHandler_KeyPressed(oEvent) as boolean
ElseIf ProcessMovementModifierKey(oEvent.KeyChar) Then
delaySpecialReset()
' If standard movement key (in VISUAL mode) like arrow keys, home, end
ElseIf MODE = "VISUAL" And ProcessStandardMovementKey(oEvent) Then
' Pass
' If bIsSpecial but nothing matched, return to normal mode
ElseIf bIsSpecial Then
gotoMode("NORMAL")
@ -339,6 +343,35 @@ Function ProcessGlobalKey(oEvent)
End Function
Function ProcessStandardMovementKey(oEvent)
dim c, bMatched
c = oEvent.KeyCode
bMatched = True
If MODE <> "VISUAL" Then
bMatched = False
'Pass
ElseIf c = 1024 Then
ProcessMovementKey("j", True)
ElseIf c = 1025 Then
ProcessMovementKey("k", True)
ElseIf c = 1026 Then
ProcessMovementKey("h", True)
ElseIf c = 1027 Then
ProcessMovementKey("l", True)
ElseIf c = 1028 Then
ProcessMovementKey("^", True)
ElseIf c = 1029 Then
ProcessMovementKey("$", True)
Else
bMatched = False
End If
ProcessStandardMovementKey = bMatched
End Function
Function ProcessNumberKey(oEvent)
dim c
c = CStr(oEvent.KeyChar)