Solves problems with next word.
Next-word (w) will now reach the next word when it involves moving the cursor down a line and that line starts with whitespace. It will now also skip over lines that only contain whitespace (like vim).
This commit is contained in:
parent
1a929ebbce
commit
47a2d62b66
|
@ -975,7 +975,23 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
|
||||||
ElseIf keyChar = "G" Then
|
ElseIf keyChar = "G" Then
|
||||||
oTextCursor.gotoEnd(bExpand)
|
oTextCursor.gotoEnd(bExpand)
|
||||||
ElseIf keyChar = "w" or keyChar = "W" Then
|
ElseIf keyChar = "w" or keyChar = "W" Then
|
||||||
|
' Using soley gotoNextWord would mean that the cursor would not be
|
||||||
|
' moved to the next word when it involved moving down a line and
|
||||||
|
' that line happened to begin with whitespace. It would also mean that
|
||||||
|
' the cursor would not skip over lines that only contain whitespace.
|
||||||
|
|
||||||
oTextCursor.gotoNextWord(bExpand)
|
oTextCursor.gotoNextWord(bExpand)
|
||||||
|
getCursor().gotoRange(oTextCursor.getStart(), False)
|
||||||
|
' Stop looping when the cursor reaches the start of a word, an empty
|
||||||
|
' line, or cannot be moved further (reaches end of file).
|
||||||
|
Do Until oTextCursor.isStartOfWord() Or (getCursor().isAtStartOfLine() And getCursor().isAtEndOfLine())
|
||||||
|
' gotoNextWord returns false when it cannot further advance the
|
||||||
|
' cursor.
|
||||||
|
If NOT oTextCursor.gotoNextWord(bExpand) Then
|
||||||
|
Exit Do
|
||||||
|
End If
|
||||||
|
getCursor().gotoRange(oTextCursor.getStart(), False)
|
||||||
|
Loop
|
||||||
ElseIf keyChar = "b" or keyChar = "B" Then
|
ElseIf keyChar = "b" or keyChar = "B" Then
|
||||||
' The function gotoPreviousWord causes a lot of problems. The
|
' The function gotoPreviousWord causes a lot of problems. The
|
||||||
' following method doesn't have to account for as many special cases.
|
' following method doesn't have to account for as many special cases.
|
||||||
|
@ -996,7 +1012,6 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
|
||||||
End If
|
End If
|
||||||
getCursor().goLeft(1, bExpand)
|
getCursor().goLeft(1, bExpand)
|
||||||
Loop
|
Loop
|
||||||
|
|
||||||
ElseIf keyChar = "e" Then
|
ElseIf keyChar = "e" Then
|
||||||
If oTextCursor.isEndOfWord(bExpand) Then
|
If oTextCursor.isEndOfWord(bExpand) Then
|
||||||
oTextCursor.gotoNextWord(bExpand)
|
oTextCursor.gotoNextWord(bExpand)
|
||||||
|
|
Loading…
Reference in New Issue