Skip to content

Commit

Permalink
JBIDE-18179: Cursor Up has no effect when moving above the first line
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Oct 10, 2014
1 parent a810148 commit a77e9ba
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public CommandType getType() {
public void handle(Document document) {
int currentOffset = document.getCursorOffset();
int currentLine = document.getLineOfOffset(currentOffset);
int currentColumn = currentOffset - document.getLineOffset(currentLine);
int newLine = currentLine - amount;
int newOffset = document.getLineOffset(newLine) + currentColumn;
document.moveCursorTo(newOffset);
if (newLine >= 0) {
int currentColumn = currentOffset - document.getLineOffset(currentLine);
int newOffset = document.getLineOffset(newLine) + currentColumn;
document.moveCursorTo(newOffset);
}
}

}

0 comments on commit a77e9ba

Please sign in to comment.