Skip to content

Commit

Permalink
Display: ArithmeticException: / by zero, fixes #526
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jun 16, 2020
1 parent ae8ff73 commit 6c81a5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,7 @@ private void doDisplay() {
size.copy(terminal.getBufferSize());

display = new Display(terminal, false);
if (size.getRows() == 0 || size.getColumns() == 0) {
display.resize(1, Integer.MAX_VALUE);
} else {
display.resize(size.getRows(), size.getColumns());
}
display.resize(size.getRows(), size.getColumns());
if (isSet(Option.DELAY_LINE_WRAP))
display.setDelayLineWrap(true);
}
Expand Down
4 changes: 4 additions & 0 deletions terminal/src/main/java/org/jline/utils/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public boolean delayLineWrap() {
public void setDelayLineWrap(boolean v) { delayLineWrap = v; }

public void resize(int rows, int columns) {
if (rows == 0 || columns == 0) {
columns = Integer.MAX_VALUE - 1;
rows = 1;
}
if (this.rows != rows || this.columns != columns) {
this.rows = rows;
this.columns = columns;
Expand Down

0 comments on commit 6c81a5b

Please sign in to comment.