1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

Bug 334969 - [terminal] Terminal fails to interpret multi-command SGR sequence

This commit is contained in:
Martin Oberhuber 2011-01-21 01:45:37 +00:00
parent a903f1e0fc
commit 6b0590a455

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,6 +16,7 @@
* Michael Scharf (Wind River) - [209746] There are cases where some colors not displayed correctly * Michael Scharf (Wind River) - [209746] There are cases where some colors not displayed correctly
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1 * Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
* Michael Scharf (Wind River) - [262996] get rid of TerminalState.OPENED * Michael Scharf (Wind River) - [262996] get rid of TerminalState.OPENED
* Martin Oberhuber (Wind River) - [334969] Fix multi-command SGR sequence
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.emulator; package org.eclipse.tm.internal.terminal.emulator;
@ -29,7 +30,6 @@ import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText;
import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin; import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.Logger;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.tm.terminal.model.ITerminalTextData; import org.eclipse.tm.terminal.model.ITerminalTextData;
import org.eclipse.tm.terminal.model.Style; import org.eclipse.tm.terminal.model.Style;
@ -725,92 +725,107 @@ public class VT100Emulator implements ControlListener {
switch (ansiParameter) { switch (ansiParameter) {
case 0: case 0:
// Reset all graphics modes. // Reset all graphics modes.
text.setStyle(text.getDefaultStyle()); style = text.getDefaultStyle();
break; break;
case 1: case 1:
text.setStyle(style.setBold(true)); style = style.setBold(true);
break;
case 4:
style = style.setUnderline(true);
break;
case 5:
style = style.setBlink(true);
break; break;
case 7: case 7:
text.setStyle(style.setReverse(true)); style = style.setReverse(true);
break; break;
case 10: // Set primary font. Ignored. case 10: // Set primary font. Ignored.
break; break;
// case 22: case 21:
// // TODO case 22:
// //currentFontStyle = SWT.NORMAL; // Cancel bold or dim attributes style = style.setBold(false);
// // only. break;
// break;
case 24:
style = style.setUnderline(false);
break;
case 25:
style = style.setBlink(false);
break;
case 27: case 27:
text.setStyle(style.setReverse(false)); style = style.setReverse(false);
break; break;
case 30: case 30:
text.setStyle(style.setForground("BLACK")); //$NON-NLS-1$ style = style.setForground("BLACK"); //$NON-NLS-1$
break; break;
case 31: case 31:
text.setStyle(style.setForground("RED")); //$NON-NLS-1$ style = style.setForground("RED"); //$NON-NLS-1$
break; break;
case 32: case 32:
text.setStyle(style.setForground("GREEN")); //$NON-NLS-1$ style = style.setForground("GREEN"); //$NON-NLS-1$
break; break;
case 33: case 33:
text.setStyle(style.setForground("YELLOW")); //$NON-NLS-1$ style = style.setForground("YELLOW"); //$NON-NLS-1$
break; break;
case 34: case 34:
text.setStyle(style.setForground("BLUE")); //$NON-NLS-1$ style = style.setForground("BLUE"); //$NON-NLS-1$
break; break;
case 35: case 35:
text.setStyle(style.setForground("MAGENTA")); //$NON-NLS-1$ style = style.setForground("MAGENTA"); //$NON-NLS-1$
break; break;
case 36: case 36:
text.setStyle(style.setForground("CYAN")); //$NON-NLS-1$ style = style.setForground("CYAN"); //$NON-NLS-1$
break; break;
case 37: case 37:
text.setStyle(style.setForground("WHITE_FOREGROUND")); //$NON-NLS-1$ style = style.setForground("WHITE_FOREGROUND"); //$NON-NLS-1$
break; break;
case 40: case 40:
text.setStyle(style.setBackground("BLACK")); //$NON-NLS-1$ style = style.setBackground("BLACK"); //$NON-NLS-1$
break; break;
case 41: case 41:
text.setStyle(style.setBackground("RED")); //$NON-NLS-1$ style = style.setBackground("RED"); //$NON-NLS-1$
break; break;
case 42: case 42:
text.setStyle(style.setBackground("GREEN")); //$NON-NLS-1$ style = style.setBackground("GREEN"); //$NON-NLS-1$
break; break;
case 43: case 43:
text.setStyle(style.setBackground("YELLOW")); //$NON-NLS-1$ style = style.setBackground("YELLOW"); //$NON-NLS-1$
break; break;
case 44: case 44:
text.setStyle(style.setBackground("BLUE")); //$NON-NLS-1$ style = style.setBackground("BLUE"); //$NON-NLS-1$
break; break;
case 45: case 45:
text.setStyle(style.setBackground("MAGENTA")); //$NON-NLS-1$ style = style.setBackground("MAGENTA"); //$NON-NLS-1$
break; break;
case 46: case 46:
text.setStyle(style.setBackground("CYAN")); //$NON-NLS-1$ style = style.setBackground("CYAN"); //$NON-NLS-1$
break; break;
case 47: case 47:
text.setStyle(style.setBackground("WHITE")); //$NON-NLS-1$ style = style.setBackground("WHITE"); //$NON-NLS-1$
break; break;
default: default:
@ -821,6 +836,7 @@ public class VT100Emulator implements ControlListener {
++parameterIndex; ++parameterIndex;
} }
text.setStyle(style);
} }
/** /**