1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 09:55:29 +02:00

Bug 420927 - ITerminalViewControl.connectTerminal() steals keyboard focus

On connect
- don't set focus
- properly reset terminal state

Use better initialization of default encoding.

Change-Id: I712958fc8ea906a15b7219be151c6d43c06762f9
Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
Anton Leherbauer 2015-02-25 10:30:05 +01:00
parent f5b531df69
commit 50a4d171c1
2 changed files with 5 additions and 4 deletions

View file

@ -28,7 +28,6 @@
package org.eclipse.tm.internal.terminal.emulator;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Reader;
import org.eclipse.swt.events.ControlEvent;
@ -1321,6 +1320,8 @@ public class VT100Emulator implements ControlListener {
public void resetState() {
ansiState=ANSISTATE_INITIAL;
text.setStyle(text.getDefaultStyle());
text.setScrollRegion(-1, -1);
text.setInsertMode(false);
}
// public OutputStream getOutputStream() {

View file

@ -48,6 +48,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.SocketException;
import java.nio.charset.Charset;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.ParameterizedCommand;
@ -144,7 +145,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
private boolean connectOnEnterIfClosed = true;
PipedInputStream fInputStream;
private static final String defaultEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding();
private static final String defaultEncoding = Charset.defaultCharset().name();
private String fEncoding = defaultEncoding;
private InputStreamReader fInputStreamReader;
@ -398,6 +399,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
if(getTerminalConnector()==null)
return;
fTerminalText.resetState();
fApplicationCursorKeys = false;
if(fConnector.getInitializationErrorMessage()!=null) {
showErrorMessage(NLS.bind(
TerminalMessages.CannotConnectTo,
@ -467,8 +469,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
if (getCtlText().isFocusControl()) {
if (getState() == TerminalState.CONNECTED)
fFocusListener.captureKeyEvents(true);
} else {
getCtlText().setFocus();
}
startReaderJob();
}