mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Terminal: Bug 433751 - Add option to enable VT100 line wrapping mode
Change-Id: I6b75db80b8edda518333c6acc59ba461f51932bd Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
parent
159fbdb61e
commit
9c72effa34
8 changed files with 120 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2014 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
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [225853][api] Provide more default functionality in TerminalConnectorImpl
|
* Martin Oberhuber (Wind River) - [225853][api] Provide more default functionality in TerminalConnectorImpl
|
||||||
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
||||||
* Uwe Stieber (Wind River) - [282996] [terminal][api] Add "hidden" attribute to terminal connector extension point
|
* Uwe Stieber (Wind River) - [282996] [terminal][api] Add "hidden" attribute to terminal connector extension point
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.connector;
|
package org.eclipse.tm.internal.terminal.connector;
|
||||||
|
|
||||||
|
@ -83,6 +84,13 @@ public class TerminalConnectorFactoryTest extends TestCase {
|
||||||
|
|
||||||
public void setConnectOnEnterIfClosed(boolean on) {
|
public void setConnectOnEnterIfClosed(boolean on) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVT100LineWrapping(boolean enable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVT100LineWrapping() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static class ConnectorMock extends TerminalConnectorImpl {
|
static class ConnectorMock extends TerminalConnectorImpl {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2014 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
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [225853][api] Provide more default functionality in TerminalConnectorImpl
|
* Martin Oberhuber (Wind River) - [225853][api] Provide more default functionality in TerminalConnectorImpl
|
||||||
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
||||||
* Uwe Stieber (Wind River) - [282996] [terminal][api] Add "hidden" attribute to terminal connector extension point
|
* Uwe Stieber (Wind River) - [282996] [terminal][api] Add "hidden" attribute to terminal connector extension point
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.connector;
|
package org.eclipse.tm.internal.terminal.connector;
|
||||||
|
|
||||||
|
@ -83,6 +84,13 @@ public class TerminalConnectorTest extends TestCase {
|
||||||
|
|
||||||
public void setConnectOnEnterIfClosed(boolean on) {
|
public void setConnectOnEnterIfClosed(boolean on) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVT100LineWrapping(boolean enable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVT100LineWrapping() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static class ConnectorMock extends TerminalConnectorImpl {
|
static class ConnectorMock extends TerminalConnectorImpl {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2014 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -169,4 +170,20 @@ public interface IVT100EmulatorBackend {
|
||||||
|
|
||||||
int getColumns();
|
int getColumns();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables VT100 line wrapping mode (default is off).
|
||||||
|
* This corresponds to the VT100 'eat_newline_glitch' terminal capability.
|
||||||
|
* If enabled, writing to the rightmost column does not cause
|
||||||
|
* an immediate wrap to the next line. Instead the line wrap occurs on the
|
||||||
|
* next output character.
|
||||||
|
*
|
||||||
|
* @param enable whether to enable or disable VT100 line wrapping mode
|
||||||
|
*/
|
||||||
|
void setVT100LineWrapping(boolean enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether VT100 line wrapping mode is enabled
|
||||||
|
*/
|
||||||
|
boolean isVT100LineWrapping();
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2014 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -141,4 +142,13 @@ public class VT100BackendTraceDecorator implements IVT100EmulatorBackend {
|
||||||
fBackend.setStyle(style);
|
fBackend.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVT100LineWrapping(boolean enable) {
|
||||||
|
fWriter.println("setVT100LineWrapping("+enable+")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fBackend.setVT100LineWrapping(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVT100LineWrapping() {
|
||||||
|
return fBackend.isVT100LineWrapping();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2003, 2014 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
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
* Kris De Volder (VMWare) - [392107] Switched interpretation for ESC[0K and ESC[1K sequences
|
* Kris De Volder (VMWare) - [392107] Switched interpretation for ESC[0K and ESC[1K sequences
|
||||||
* Martin Oberhuber (Wind River) - [401386] Regression: No header on top due to incorrect ESC[K interpretation
|
* Martin Oberhuber (Wind River) - [401386] Regression: No header on top due to incorrect ESC[K interpretation
|
||||||
* Martin Oberhuber (Wind River) - [401480] Handle ESC[39;49m and ESC[G
|
* Martin Oberhuber (Wind River) - [401480] Handle ESC[39;49m and ESC[G
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -1150,6 +1151,7 @@ public class VT100Emulator implements ControlListener {
|
||||||
* Buffer for {@link #pushBackChar(char)}.
|
* Buffer for {@link #pushBackChar(char)}.
|
||||||
*/
|
*/
|
||||||
private int fNextChar=-1;
|
private int fNextChar=-1;
|
||||||
|
|
||||||
private char getNextChar() throws IOException {
|
private char getNextChar() throws IOException {
|
||||||
int c=-1;
|
int c=-1;
|
||||||
if(fNextChar!=-1) {
|
if(fNextChar!=-1) {
|
||||||
|
@ -1189,4 +1191,10 @@ public class VT100Emulator implements ControlListener {
|
||||||
public void setCrAfterNewLine(boolean crAfterNewLine) {
|
public void setCrAfterNewLine(boolean crAfterNewLine) {
|
||||||
fCrAfterNewLine = crAfterNewLine;
|
fCrAfterNewLine = crAfterNewLine;
|
||||||
}
|
}
|
||||||
|
void setVT100LineWrapping(boolean enable) {
|
||||||
|
text.setVT100LineWrapping(enable);
|
||||||
|
}
|
||||||
|
boolean isVT100LineWrapping() {
|
||||||
|
return text.isVT100LineWrapping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2014 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
* Anton Leherbauer (Wind River) - [206329] Changing terminal size right after connect does not scroll properly
|
* Anton Leherbauer (Wind River) - [206329] Changing terminal size right after connect does not scroll properly
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -39,19 +40,26 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
|
||||||
* When fCursorColumn is N, the next character output to the terminal appears
|
* When fCursorColumn is N, the next character output to the terminal appears
|
||||||
* in column N. When a character is output to the rightmost column on a
|
* in column N. When a character is output to the rightmost column on a
|
||||||
* given line (column widthInColumns - 1), the cursor moves to column 0 on
|
* given line (column widthInColumns - 1), the cursor moves to column 0 on
|
||||||
* the next line after the character is drawn (this is how line wrapping is
|
* the next line after the character is drawn (this is the default line wrapping
|
||||||
* implemented). If the cursor is in the bottommost line when line wrapping
|
* mode). If VT100 line wrapping mode is enabled, the cursor does not move
|
||||||
|
* to the next line until the next character is printed (this is known as
|
||||||
|
* the VT100 'eat_newline_glitch').
|
||||||
|
* If the cursor is in the bottommost line when line wrapping
|
||||||
* occurs, the topmost visible line is scrolled off the top edge of the
|
* occurs, the topmost visible line is scrolled off the top edge of the
|
||||||
* screen.
|
* screen.
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
private int fCursorColumn;
|
private int fCursorColumn;
|
||||||
private int fCursorLine;
|
private int fCursorLine;
|
||||||
|
/* true if last output occurred on rightmost column
|
||||||
|
* and next output requires line wrap */
|
||||||
|
private boolean fWrapPending;
|
||||||
private Style fDefaultStyle;
|
private Style fDefaultStyle;
|
||||||
private Style fStyle;
|
private Style fStyle;
|
||||||
int fLines;
|
int fLines;
|
||||||
int fColumns;
|
int fColumns;
|
||||||
final private ITerminalTextData fTerminal;
|
final private ITerminalTextData fTerminal;
|
||||||
|
private boolean fVT100LineWrapping;
|
||||||
public VT100EmulatorBackend(ITerminalTextData terminal) {
|
public VT100EmulatorBackend(ITerminalTextData terminal) {
|
||||||
fTerminal=terminal;
|
fTerminal=terminal;
|
||||||
}
|
}
|
||||||
|
@ -284,15 +292,27 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
|
||||||
int line=toAbsoluteLine(fCursorLine);
|
int line=toAbsoluteLine(fCursorLine);
|
||||||
int i=0;
|
int i=0;
|
||||||
while (i < chars.length) {
|
while (i < chars.length) {
|
||||||
|
if(fWrapPending) {
|
||||||
|
doNewline();
|
||||||
|
line=toAbsoluteLine(fCursorLine);
|
||||||
|
setCursorColumn(0);
|
||||||
|
}
|
||||||
int n=Math.min(fColumns-fCursorColumn,chars.length-i);
|
int n=Math.min(fColumns-fCursorColumn,chars.length-i);
|
||||||
fTerminal.setChars(line, fCursorColumn, chars, i, n, fStyle);
|
fTerminal.setChars(line, fCursorColumn, chars, i, n, fStyle);
|
||||||
int col=fCursorColumn+n;
|
int col=fCursorColumn+n;
|
||||||
i+=n;
|
i+=n;
|
||||||
// wrap needed?
|
// wrap needed?
|
||||||
if(col>=fColumns) {
|
if(col == fColumns) {
|
||||||
|
if (fVT100LineWrapping) {
|
||||||
|
// deferred line wrapping (eat_newline_glitch)
|
||||||
|
setCursorColumn(col - 1);
|
||||||
|
fWrapPending = true;
|
||||||
|
} else {
|
||||||
|
// immediate line wrapping
|
||||||
doNewline();
|
doNewline();
|
||||||
line=toAbsoluteLine(fCursorLine);
|
line=toAbsoluteLine(fCursorLine);
|
||||||
setCursorColumn(0);
|
setCursorColumn(0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setCursorColumn(col);
|
setCursorColumn(col);
|
||||||
}
|
}
|
||||||
|
@ -357,6 +377,7 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
|
||||||
else if(targetColumn>=fColumns)
|
else if(targetColumn>=fColumns)
|
||||||
targetColumn=fColumns-1;
|
targetColumn=fColumns-1;
|
||||||
fCursorColumn=targetColumn;
|
fCursorColumn=targetColumn;
|
||||||
|
fWrapPending = false;
|
||||||
// We make the assumption that nobody is changing the
|
// We make the assumption that nobody is changing the
|
||||||
// terminal cursor except this class!
|
// terminal cursor except this class!
|
||||||
// This assumption gives a huge performance improvement
|
// This assumption gives a huge performance improvement
|
||||||
|
@ -398,4 +419,12 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
|
||||||
return fColumns;
|
return fColumns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVT100LineWrapping(boolean enable) {
|
||||||
|
fVT100LineWrapping = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVT100LineWrapping() {
|
||||||
|
return fVT100LineWrapping;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2003, 2014 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
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
* Simon Bernard (Sierra Wireless) - [351424] [terminal] Terminal does not support del and insert key
|
* Simon Bernard (Sierra Wireless) - [351424] [terminal] Terminal does not support del and insert key
|
||||||
* Martin Oberhuber (Wind River) - [265352][api] Allow setting fonts programmatically
|
* Martin Oberhuber (Wind River) - [265352][api] Allow setting fonts programmatically
|
||||||
* Martin Oberhuber (Wind River) - [378691][api] push Preferences into the Widget
|
* Martin Oberhuber (Wind River) - [378691][api] push Preferences into the Widget
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -1181,5 +1182,13 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
return connectOnEnterIfClosed;
|
return connectOnEnterIfClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVT100LineWrapping(boolean enable) {
|
||||||
|
getTerminalText().setVT100LineWrapping(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVT100LineWrapping() {
|
||||||
|
return getTerminalText().isVT100LineWrapping();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2014 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
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
* Martin Oberhuber (Wind River) - [204796] Terminal should allow setting the encoding to use
|
||||||
* Martin Oberhuber (Wind River) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend
|
* Martin Oberhuber (Wind River) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend
|
||||||
|
* Anton Leherbauer (Wind River) - [433751] Add option to enable VT100 line wrapping mode
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.provisional.api;
|
package org.eclipse.tm.internal.terminal.provisional.api;
|
||||||
|
|
||||||
|
@ -140,4 +141,20 @@ public interface ITerminalControl {
|
||||||
* @return <code>True</code> the reconnect is enabled, <code>false</code> if disabled.
|
* @return <code>True</code> the reconnect is enabled, <code>false</code> if disabled.
|
||||||
*/
|
*/
|
||||||
boolean isConnectOnEnterIfClosed();
|
boolean isConnectOnEnterIfClosed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables VT100 line wrapping mode (default is off).
|
||||||
|
* This corresponds to the VT100 'eat_newline_glitch' terminal capability.
|
||||||
|
* If enabled, writing to the rightmost column does not cause
|
||||||
|
* an immediate wrap to the next line. Instead the line wrap occurs on the
|
||||||
|
* next output character.
|
||||||
|
*
|
||||||
|
* @param enable whether to enable or disable VT100 line wrapping mode
|
||||||
|
*/
|
||||||
|
void setVT100LineWrapping(boolean enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether VT100 line wrapping mode is enabled
|
||||||
|
*/
|
||||||
|
boolean isVT100LineWrapping();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue