Skip to content

Commit

Permalink
On some terminals when using a right prompt, the cursor is positioned…
Browse files Browse the repository at this point in the history
… one character on the right of its correct location, fixes #105
  • Loading branch information
gnodet committed Mar 23, 2017
1 parent 477cb55 commit 1051778
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions terminal/src/main/java/org/jline/utils/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,8 @@ protected int moveVisualCursorTo(int i1) {
int l1 = i1 / width;
int c1 = i1 % width;
if (c0 == columns) { // at right margin
if (c1 == 0) {
terminal.puts(Capability.carriage_return);
c0 = 0;
} else {
// If we're at the right margin, a cursor_left moves
// *two* column positions. But now we know where we are ...
terminal.puts(Capability.cursor_left);
c0 = c0 - 2;
}
terminal.puts(Capability.carriage_return);
c0 = 0;
}
if (l0 > l1) {
perform(Capability.cursor_up, Capability.parm_up_cursor, l0 - l1);
Expand Down

0 comments on commit 1051778

Please sign in to comment.