diff --git a/app/src/main/java/imo/text/Editor.java b/app/src/main/java/imo/text/Editor.java index 3c244e7..e74b713 100644 --- a/app/src/main/java/imo/text/Editor.java +++ b/app/src/main/java/imo/text/Editor.java @@ -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 prevWord = currLine.wordList.get(prevWordIndex); currCharPosition = prevWord.get(0);