d,D,c,C, and some renaming
This commit is contained in:
parent
ca637e054f
commit
113d5ab1b3
|
@ -173,9 +173,10 @@ function KeyHandler_KeyPressed(oEvent) as boolean
|
||||||
bConsumeInput = False ' Allow all inputs
|
bConsumeInput = False ' Allow all inputs
|
||||||
|
|
||||||
' If Change Mode
|
' If Change Mode
|
||||||
ElseIf ProcessModeKey(oEvent) Then
|
ElseIf MODE = "NORMAL" And ProcessModeKey(oEvent) Then
|
||||||
' Pass
|
' Pass
|
||||||
|
|
||||||
|
' Multiplier Key
|
||||||
ElseIf ProcessNumberKey(oEvent) Then
|
ElseIf ProcessNumberKey(oEvent) Then
|
||||||
bIsMultiplier = True
|
bIsMultiplier = True
|
||||||
|
|
||||||
|
@ -275,8 +276,12 @@ Function ProcessNormalKey(oEvent)
|
||||||
For i = 1 To getMultiplier()
|
For i = 1 To getMultiplier()
|
||||||
dim bMatchedMovement, bMatchedDelete
|
dim bMatchedMovement, bMatchedDelete
|
||||||
|
|
||||||
|
' Movement Key
|
||||||
bMatchedMovement = ProcessMovementKey(oEvent.KeyChar, bIsVisual, oEvent.Modifiers)
|
bMatchedMovement = ProcessMovementKey(oEvent.KeyChar, bIsVisual, oEvent.Modifiers)
|
||||||
bMatchedDelete = ProcessDeleteKey(oEvent)
|
' Delete Key
|
||||||
|
bMatchedDelete = ProcessDeleteKey(oEvent.KeyChar)
|
||||||
|
' Selection Modifier Key
|
||||||
|
|
||||||
bMatched = bMatched or bMatchedMovement or bMatchedDelete
|
bMatched = bMatched or bMatchedMovement or bMatchedDelete
|
||||||
|
|
||||||
' Special case: Break from For loop if in visual mode and has deleted,
|
' Special case: Break from For loop if in visual mode and has deleted,
|
||||||
|
@ -288,23 +293,59 @@ Function ProcessNormalKey(oEvent)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Function ProcessDeleteKey(oEvent)
|
Function ProcessDeleteKey(keyChar)
|
||||||
dim oTextCursor, bMatched
|
dim oTextCursor, bMatched
|
||||||
oTextCursor = getTextCursor()
|
|
||||||
bMatched = True
|
bMatched = True
|
||||||
Select Case oEvent.KeyChar
|
|
||||||
' Case "d":
|
|
||||||
' setSpecial("d")
|
|
||||||
|
|
||||||
|
Select Case keyChar
|
||||||
Case "x":
|
Case "x":
|
||||||
|
oTextCursor = getTextCursor()
|
||||||
thisComponent.getCurrentController.Select(oTextCursor)
|
thisComponent.getCurrentController.Select(oTextCursor)
|
||||||
oTextCursor.setString("")
|
oTextCursor.setString("")
|
||||||
|
|
||||||
|
Case "D", "C":
|
||||||
|
If MODE = "VISUAL" Then
|
||||||
|
ProcessMovementKey("^", False)
|
||||||
|
ProcessMovementKey("$", True)
|
||||||
|
ProcessMovementKey("l", True)
|
||||||
|
Else
|
||||||
|
' Deselect
|
||||||
|
oTextCursor = getTextCursor()
|
||||||
|
oTextCursor.gotoRange(oTextCursor.getStart(), False)
|
||||||
|
thisComponent.getCurrentController.Select(oTextCursor)
|
||||||
|
ProcessMovementKey("$", True)
|
||||||
|
End If
|
||||||
|
|
||||||
|
getTextCursor().setString("")
|
||||||
|
|
||||||
|
If keyChar = "D" Then
|
||||||
|
gotoMode("NORMAL")
|
||||||
|
ElseIf keyChar = "C" Then
|
||||||
|
gotoMode("INSERT")
|
||||||
|
End IF
|
||||||
|
|
||||||
|
Case "d", "c":
|
||||||
|
If MODE = "VISUAL" Then
|
||||||
|
oTextCursor = getTextCursor()
|
||||||
|
thisComponent.getCurrentController.Select(oTextCursor)
|
||||||
|
oTextCursor.setString("")
|
||||||
|
|
||||||
|
|
||||||
|
' c/C
|
||||||
|
If keyChar = "c" Or keyChar = "C" Then
|
||||||
|
gotoMode("INSERT")
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Always go back to NORMAL mode after delete in VISUAL mode
|
||||||
|
' If MODE = "VISUAL" Then gotoMode("NORMAL")
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Case Else:
|
Case Else:
|
||||||
bMatched = False
|
bMatched = False
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
ProcessDeleteKey = bMatched
|
ProcessDeleteKey = bMatched
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,13 +363,13 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
|
||||||
|
|
||||||
' Check for modified keys (Ctrl, Alt, not Shift)
|
' Check for modified keys (Ctrl, Alt, not Shift)
|
||||||
If keyModifiers > 1 Then
|
If keyModifiers > 1 Then
|
||||||
dim isControl
|
dim bIsControl
|
||||||
isControl = (keyModifiers = 2) or (keyModifiers = 8)
|
bIsControl = (keyModifiers = 2) or (keyModifiers = 8)
|
||||||
|
|
||||||
' Ctrl+d and Ctrl+u
|
' Ctrl+d and Ctrl+u
|
||||||
If isControl and keyChar = "d" Then
|
If bIsControl and keyChar = "d" Then
|
||||||
getCursor().ScreenDown(bExpand)
|
getCursor().ScreenDown(bExpand)
|
||||||
ElseIf isControl and keyChar = "u" Then
|
ElseIf bIsControl and keyChar = "u" Then
|
||||||
getCursor().ScreenUp(bExpand)
|
getCursor().ScreenUp(bExpand)
|
||||||
Else
|
Else
|
||||||
bMatched = False
|
bMatched = False
|
||||||
|
|
Loading…
Reference in New Issue