Skip to content

Commit

Permalink
feat(Vim Motion): multi line navigation support for motion B
Browse files Browse the repository at this point in the history
  • Loading branch information
IMOitself committed Oct 3, 2024
1 parent fb7b66c commit 003354a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/main/java/imo/text/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ void moveCursorToPrevWordStart(){

// only go to previous word if the cursor is at first char of current word
int prevWordIndex = currWordIndex - 1;
if(prevWordIndex < 0) return;
if(prevWordIndex < 0) { // can't go backward any further
int prevLinePosition = currLinePosition - 1;
if(prevLinePosition < 0) return;

currLine = Lines.get(prevLinePosition);
prevWordIndex = currLine.wordList.size() - 1;
currLinePosition = prevLinePosition;
}

List<Integer> prevWord = currLine.wordList.get(prevWordIndex);
currCharPosition = prevWord.get(0);
Expand Down

0 comments on commit 003354a

Please sign in to comment.