#16: add y for yank

This commit is contained in:
Sean Yeh 2015-07-30 17:04:06 -05:00
parent f25a3bfff4
commit 6594264714
1 changed files with 11 additions and 9 deletions

View File

@ -498,8 +498,8 @@ Function ProcessNormalKey(keyChar, modifiers)
' If Special: d/c + movement ' If Special: d/c + movement
If bMatched And (getSpecial() = "d" Or getSpecial() = "c") Then If bMatched And (getSpecial() = "d" Or getSpecial() = "c" Or getSpecial() = "y") Then
yankSelection(True) yankSelection((getSpecial() <> "y"))
End If End If
Next i Next i
@ -509,7 +509,7 @@ Function ProcessNormalKey(keyChar, modifiers)
' Exit already if movement key was matched ' Exit already if movement key was matched
If bMatched Then If bMatched Then
' If Special: d/c : change mode ' If Special: d/c : change mode
If getSpecial() = "d" Then gotoMode("NORMAL") If getSpecial() = "d" Or getSpecial() = "y" Then gotoMode("NORMAL")
If getSpecial() = "c" Then gotoMode("INSERT") If getSpecial() = "c" Then gotoMode("INSERT")
ProcessNormalKey = True ProcessNormalKey = True
@ -597,12 +597,14 @@ End Sub
Function ProcessSpecialKey(keyChar) Function ProcessSpecialKey(keyChar)
dim oTextCursor, bMatched, bIsSpecial dim oTextCursor, bMatched, bIsSpecial, bIsDelete
bMatched = True bMatched = True
bIsSpecial = getSpecial() <> "" bIsSpecial = getSpecial() <> ""
If keyChar = "d" Or keyChar = "c" Or keyChar = "s" Then If keyChar = "d" Or keyChar = "c" Or keyChar = "s" Or keyChar = "y" Then
bIsDelete = (keyChar <> "y")
' Special Cases: 'dd' and 'cc' ' Special Cases: 'dd' and 'cc'
If bIsSpecial Then If bIsSpecial Then
dim bIsSpecialCase dim bIsSpecialCase
@ -614,7 +616,7 @@ Function ProcessSpecialKey(keyChar)
oTextCursor = getTextCursor() oTextCursor = getTextCursor()
thisComponent.getCurrentController.Select(oTextCursor) thisComponent.getCurrentController.Select(oTextCursor)
yankSelection(True) yankSelection(bIsDelete)
Else Else
bMatched = False bMatched = False
End If End If
@ -632,13 +634,13 @@ Function ProcessSpecialKey(keyChar)
oTextCursor = getTextCursor() oTextCursor = getTextCursor()
thisComponent.getCurrentController.Select(oTextCursor) thisComponent.getCurrentController.Select(oTextCursor)
yankSelection(True) yankSelection(bIsDelete)
If keyChar = "c" Or keyChar = "s" Then gotoMode("INSERT") If keyChar = "c" Or keyChar = "s" Then gotoMode("INSERT")
If keyChar = "d" Then gotoMode("NORMAL") If keyChar = "d" Or keyChar = "y" Then gotoMode("NORMAL")
' Enter Special mode: 'd' or 'c', ('s' => 'cl') ' Enter Special mode: 'd', 'c', or 'y' ('s' => 'cl')
ElseIf MODE = "NORMAL" Then ElseIf MODE = "NORMAL" Then
' 's' => 'cl' ' 's' => 'cl'