Skip to content

Commit

Permalink
nano: now manages tabs correctly also in wrapped lines
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Oct 5, 2019
1 parent 4abce45 commit 54dfee6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions builtins/src/main/java/org/jline/builtins/Nano.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ void computeAllOffsets() {
}
}

LinkedList<Integer> computeOffsets(String text) {
LinkedList<Integer> computeOffsets(String line) {
String text = new AttributedStringBuilder().tabs(tabs).append(line).toString();
int width = size.getColumns() - (printLineNumbers ? 8 : 0);
LinkedList<Integer> offsets = new LinkedList<>();
offsets.add(0);
Expand Down Expand Up @@ -661,7 +662,7 @@ private void cursorDown(int lines) {
column = Math.min(wantedColumn, next - offsetInLine);
}
}
moveToChar(column);
moveToChar(offsetInLine + column);
}

private void cursorUp(int lines) {
Expand Down Expand Up @@ -690,7 +691,7 @@ private void cursorUp(int lines) {
}
}
}
moveToChar(column);
moveToChar(offsetInLine + column);
}

void ensureCursorVisible() {
Expand Down

0 comments on commit 54dfee6

Please # to comment.