diff --git a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java --- a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java +++ b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java @@ -87,7 +87,8 @@ String tty = PtySupport.getTTY(process); if (tty != null) { try { - IONotifier.addPropertyChangeListener(io, new ResizeListener(process.getExecutionEnvironment(), tty)); + ResizeListener resizeListener = new ResizeListener(io, process.getExecutionEnvironment(), tty); + IONotifier.addPropertyChangeListener(io, resizeListener); } catch (CancellationException ex) { // TODO:CancellationException error processing } catch (IOException ex) { @@ -118,7 +119,8 @@ if (IOResizable.isSupported(io)) { try { - IONotifier.addPropertyChangeListener(io, new ResizeListener(pty.getEnv(), pty.getSlaveName())); + ResizeListener resizeListener = new ResizeListener(io, pty.getEnv(), pty.getSlaveName()); + IONotifier.addPropertyChangeListener(io, resizeListener); } catch (IOException ex) { Exceptions.printStackTrace(ex); } catch (CancellationException ex) { @@ -133,12 +135,16 @@ private final Object lock = new Object(); + private final InputOutput io; + private Task task = null; private Dimension cells; private Dimension pixels; private final boolean pxlsAware; - ResizeListener(final ExecutionEnvironment env, final String tty) throws IOException, CancellationException { + ResizeListener(InputOutput io, final ExecutionEnvironment env, final String tty) throws IOException, CancellationException { + this.io = io; + final HostInfo hinfo = HostInfoUtils.getHostInfo(env); if (OSFamily.SUNOS.equals(hinfo.getOSFamily())) { @@ -180,6 +186,8 @@ : String.format("cols %d rows %d", c.width, c.height); // NOI18N SttySupport.apply(env, tty, cmd); + + IOTerm.updateScreen(ResizeListener.this.io); } }, true); } @@ -204,7 +212,8 @@ this.pixels = new Dimension(newPixels); } - task.schedule(0); + // 1s delay helps us to ignore tons of events when resizing (i.e. continiusly, using mouse).ы + task.schedule(1000); } } } diff --git a/terminal.nb/nbproject/project.properties b/terminal.nb/nbproject/project.properties --- a/terminal.nb/nbproject/project.properties +++ b/terminal.nb/nbproject/project.properties @@ -35,5 +35,5 @@ # made subject to such option by the copyright holder. # # Contributor(s): -javac.source=1.7 +javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/terminal.nb/src/org/netbeans/modules/terminal/ioprovider/TerminalInputOutput.java b/terminal.nb/src/org/netbeans/modules/terminal/ioprovider/TerminalInputOutput.java --- a/terminal.nb/src/org/netbeans/modules/terminal/ioprovider/TerminalInputOutput.java +++ b/terminal.nb/src/org/netbeans/modules/terminal/ioprovider/TerminalInputOutput.java @@ -524,8 +524,17 @@ setFocusTaken(true); } } - - + + @Override + protected void updateScreen() { + SwingUtilities.invokeLater(() -> { + Term term = term(); + + if (term != null) { + term.setRowsColumns(200, 200); + } + }); + } } private class MyIONotifier extends IONotifier { diff --git a/terminal/src/org/netbeans/modules/terminal/api/IOTerm.java b/terminal/src/org/netbeans/modules/terminal/api/IOTerm.java --- a/terminal/src/org/netbeans/modules/terminal/api/IOTerm.java +++ b/terminal/src/org/netbeans/modules/terminal/api/IOTerm.java @@ -156,6 +156,14 @@ } iot.requestFocus(); } + + public static void updateScreen(InputOutput io) { + IOTerm iot = find(io); + if (iot == null) { + return; + } + iot.updateScreen(); + } /** * Connect an I/O stream pair or triple to this Term. @@ -178,4 +186,6 @@ abstract protected void setReadOnly(boolean isReadOnly); abstract protected void requestFocus(); + + abstract protected void updateScreen(); }