From fd943359b796b157eaf6dcb672b3a8611346513a Mon Sep 17 00:00:00 2001 From: mattirn Date: Sun, 5 May 2019 10:08:47 +0200 Subject: [PATCH] invoke status.hardReset() after resizing terminal window --- .../main/java/org/jline/reader/impl/LineReaderImpl.java | 7 ++++++- terminal/src/main/java/org/jline/utils/Status.java | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java index b0ba725ec..1e34a7467 100644 --- a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java +++ b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java @@ -1021,8 +1021,13 @@ protected String finishBuffer() { protected void handleSignal(Signal signal) { if (signal == Signal.WINCH) { + Status status = Status.getStatus(terminal, false); + if (status != null) { + status.hardReset(); + } size.copy(terminal.getBufferSize()); display.resize(size.getRows(), size.getColumns()); + redrawLine(); redisplay(); } else if (signal == Signal.CONT) { @@ -1034,7 +1039,7 @@ else if (signal == Signal.CONT) { redisplay(); } } - + @SuppressWarnings("unchecked") protected Widget getWidget(Object binding) { Widget w; diff --git a/terminal/src/main/java/org/jline/utils/Status.java b/terminal/src/main/java/org/jline/utils/Status.java index b00bac922..dccab0ce2 100644 --- a/terminal/src/main/java/org/jline/utils/Status.java +++ b/terminal/src/main/java/org/jline/utils/Status.java @@ -61,6 +61,12 @@ public void reset() { this.force = true; } + public void hardReset() { + List lines = new ArrayList<>(oldLines); + update(null); + update(lines); + } + public void redraw() { update(oldLines); }