diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalControl.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalControl.java index 17baf916ebc..7fa1bd259a5 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalControl.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalControl.java @@ -238,6 +238,7 @@ public class TerminalControl implements ITerminalControlForText, ITerminalContro Logger.log("entered."); //$NON-NLS-1$ if(fConnector==null) return; + fTerminalText.resetState(); fConnector.connect(this); // clean the error message setMsg(""); //$NON-NLS-1$ diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalText.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalText.java index 07771b6c7cb..f2c27b3f264 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalText.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalText.java @@ -308,10 +308,7 @@ public class TerminalText implements ControlListener { text.addControlListener(this); - currentForegroundColor = text.getForeground(); - currentBackgroundColor = text.getBackground(); - currentFontStyle = SWT.NORMAL; - reverseVideo = false; + resetState(); } @@ -1986,7 +1983,17 @@ public class TerminalText implements ControlListener { cursorColumn -= columnsToMove; } - + /** + * Resets the state of the terminal text (foreground color, background color, + * font style and other internal state). It essentially makes it ready for new input. + */ + public void resetState() { + ansiState=ANSISTATE_INITIAL; + currentForegroundColor = text.getForeground(); + currentBackgroundColor = text.getBackground(); + currentFontStyle = SWT.NORMAL; + reverseVideo = false; + } protected int getBufferLineLimit() { return fBufferLineLimit; }