X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjexer%2FTTerminalWindow.java;h=af319c92d92ea3308037a998463a6c3f777e9a12;hb=b2d49e0f15810a35a206e88c9bad11b053ed65fc;hp=31834eebc2324bc02f9e7261277d3994a108ca1b;hpb=b6faeac0d9c3e3ae3376ed28b54ec6ea6408ad7a;p=fanfix.git diff --git a/src/jexer/TTerminalWindow.java b/src/jexer/TTerminalWindow.java index 31834ee..af319c9 100644 --- a/src/jexer/TTerminalWindow.java +++ b/src/jexer/TTerminalWindow.java @@ -39,8 +39,10 @@ import java.util.ResourceBundle; import jexer.bits.Cell; import jexer.bits.CellAttributes; import jexer.event.TKeypressEvent; +import jexer.event.TMenuEvent; import jexer.event.TMouseEvent; import jexer.event.TResizeEvent; +import jexer.menu.TMenu; import jexer.tterminal.DisplayLine; import jexer.tterminal.DisplayListener; import jexer.tterminal.ECMA48; @@ -187,6 +189,20 @@ public class TTerminalWindow extends TScrollableWindow newStatusBar(i18n.getString("statusBarRunning")); } + /** + * Public constructor spawns a custom command line. + * + * @param application TApplication that manages this window + * @param x column relative to parent + * @param y row relative to parent + * @param commandLine the command line to execute + */ + public TTerminalWindow(final TApplication application, final int x, + final int y, final String commandLine) { + + this(application, x, y, RESIZABLE, commandLine); + } + /** * Public constructor spawns a custom command line. * @@ -399,7 +415,7 @@ public class TTerminalWindow extends TScrollableWindow * Called by emulator when fresh data has come in. */ public void displayChanged() { - doRepaint(); + getApplication().postEvent(new TMenuEvent(TMenu.MID_REPAINT)); } /** @@ -439,6 +455,13 @@ public class TTerminalWindow extends TScrollableWindow } } + /** + * Hook for subclasses to be notified of the shell termination. + */ + public void onShellExit() { + getApplication().postEvent(new TMenuEvent(TMenu.MID_REPAINT)); + } + /** * Copy out variables from the emulator that TTerminal has to expose on * screen. @@ -478,6 +501,7 @@ public class TTerminalWindow extends TScrollableWindow clearShortcutKeypresses(); statusBar.setText(MessageFormat.format(i18n. getString("statusBarCompleted"), rc)); + onShellExit(); } catch (IllegalThreadStateException e) { // The emulator thread has exited, but the shell Process // hasn't figured that out yet. Do nothing, we will see @@ -495,6 +519,7 @@ public class TTerminalWindow extends TScrollableWindow clearShortcutKeypresses(); statusBar.setText(MessageFormat.format(i18n. getString("statusBarCompleted"), rc)); + onShellExit(); } catch (IllegalThreadStateException e) { // The shell is still running, do nothing. }