1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 453393 - Add support for copying wrapped lines without line break

Change-Id: Id4e836854bffd4f58243018e240cac917bb04c73
Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
Anton Leherbauer 2014-11-27 17:01:26 +01:00 committed by Uwe Stieber
parent 208cb478a4
commit f50eae0f94
38 changed files with 225 additions and 80 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.terminals.ui;singleton:=true
Bundle-Version: 1.2.100.qualifier
Bundle-Version: 1.2.200.qualifier
Bundle-Activator: org.eclipse.rse.internal.terminals.ui.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.rse.ui;bundle-version="[3.1.0,4.0.0)",
org.eclipse.rse.subsystems.terminals.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)"
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Bundle-Vendor: %providerName

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.rse.terminals.ui</artifactId>
<version>1.2.100-SNAPSHOT</version>
<version>1.2.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -43,7 +43,7 @@
<import plugin="org.eclipse.debug.core"/>
<import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal.view" version="2.4.1" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.externaltools"/>

View file

@ -38,7 +38,7 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
</requires>
<plugin

View file

@ -38,7 +38,7 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
<import plugin="org.eclipse.jsch.core" version="1.0.0" match="compatible"/>
<import plugin="com.jcraft.jsch" version="0.1.31" match="compatible"/>
</requires>

View file

@ -38,7 +38,7 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
</requires>
<plugin

View file

@ -38,7 +38,7 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
<import plugin="org.junit" version="3.8.1" match="compatible"/>
<import plugin="org.apache.ant"/>
</requires>

View file

@ -39,7 +39,7 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.2" match="equivalent"/>
<import plugin="org.eclipse.tm.terminal" version="3.3.0" match="equivalent"/>
</requires>
<plugin

View file

@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.local;singleton:=true
Bundle-Version: 0.2.200.qualifier
Bundle-Version: 0.2.300.qualifier
Bundle-Activator: org.eclipse.tm.internal.terminal.local.LocalTerminalActivator
Bundle-Localization: plugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)",
Require-Bundle: org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)",
org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
org.eclipse.core.runtime,
org.eclipse.debug.core;bundle-version="3.6",

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.local</artifactId>
<version>0.2.200.qualifier</version>
<version>0.2.300.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.serial;singleton:=true
Bundle-Version: 2.1.300.qualifier
Bundle-Version: 2.1.400.qualifier
Bundle-Localization: plugin
Import-Package: gnu.io;resolution:=optional
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)"
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Eclipse-BuddyPolicy: ext

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.serial</artifactId>
<version>2.1.300.qualifier</version>
<version>2.1.400.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.ssh;singleton:=true
Bundle-Version: 2.1.300.qualifier
Bundle-Version: 2.1.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)",
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)",
com.jcraft.jsch;bundle-version="[0.1.31,1.0.0)",
org.eclipse.jsch.core;bundle-version="[1.0.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.4

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.ssh</artifactId>
<version>2.1.300.qualifier</version>
<version>2.1.400.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -20,6 +20,7 @@
* Michael Scharf (Wind River) - 240420: [terminal][ssh]Channel is not closed when the connection is closed with the close button
* Martin Oberhuber (Wind River) - [206919] Improve SSH Terminal Error Reporting
* Andrei Sobolev (Xored) - [250456] Ssh banner message causes IllegalArgumentException popup
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.ssh;
@ -137,7 +138,9 @@ class SshConnection extends Thread {
if(!isSessionConnected())
return;
ChannelShell channel=(ChannelShell) session.openChannel("shell"); //$NON-NLS-1$
channel.setPtyType("ansi"); //$NON-NLS-1$
channel.setPtyType("xterm"); //$NON-NLS-1$
// TERM=xterm implies VT100 line wrapping mode
fControl.setVT100LineWrapping(true);
channel.connect();
// maybe the terminal was disconnected while we were connecting

View file

@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.telnet;singleton:=true
Bundle-Version: 2.1.300.qualifier
Bundle-Version: 2.1.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)"
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Export-Package: org.eclipse.tm.internal.terminal.telnet;x-internal:=true

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.telnet</artifactId>
<version>2.1.300.qualifier</version>
<version>2.1.400.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2005, 2014 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [225853][api] Provide more default functionality in TerminalConnectorImpl
* Sean Adams (Cisco) - [231959][terminal][telnet] NPE in TelnetConnector.java
* David Sciamma (Anyware-Tech) - [288254][telnet] local echo is always disabled
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.telnet;
@ -50,6 +51,8 @@ public class TelnetConnector extends TerminalConnectorImpl {
super.connect(control);
fWidth=-1;
fHeight=-1;
// TERM=xterm implies VT100 line wrapping mode
control.setVT100LineWrapping(true);
TelnetConnectWorker worker = new TelnetConnectWorker(this,control);
worker.start();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2005, 2014 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
* Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Martin Oberhuber (Wind River) - [267181] Fix telnet option negotiation loop
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.telnet;
@ -504,7 +505,7 @@ class TelnetOption implements TelnetCodes
/**
* This method handles a subnegotiation command received from the remote endpoint.
* Currently, the only subnegotiation we handle is when the remote endpoint
* commands us to send our terminal type (which is "ansi").
* commands us to send our terminal type (which is "xterm").
*
* @param subnegotiationData An array of bytes containing a TELNET
* subnegotiation command received from the
@ -526,11 +527,11 @@ class TelnetOption implements TelnetCodes
// Tell the remote endpoint our terminal type is "ansi" using this sequence
// of TELNET protocol bytes:
//
// IAC SB TERMINAL-TYPE IS a n s i IAC SE
// IAC SB TERMINAL-TYPE IS x t e r m IAC SE
byte[] terminalTypeData = { TELNET_IAC, TELNET_SB,
TELNET_OPTION_TERMINAL_TYPE, TELNET_IS, (byte) 'a',
(byte) 'n', (byte) 's', (byte) 'i', TELNET_IAC, TELNET_SE };
TELNET_OPTION_TERMINAL_TYPE, TELNET_IS, (byte) 'x',
(byte) 't', (byte) 'e', (byte) 'r', (byte) 'm', TELNET_IAC, TELNET_SE };
try {
outputStream.write(terminalTypeData);

View file

@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.test;singleton:=true
Bundle-Version: 2.2.100.qualifier
Bundle-Version: 2.3.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.junit,
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)",
org.eclipse.tm.terminal;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.runtime,
org.eclipse.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View file

@ -10,7 +10,7 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.test</artifactId>
<version>2.2.100.qualifier</version>
<version>2.3.0.qualifier</version>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.emulator;
@ -1234,4 +1235,53 @@ public class VT100EmulatorBackendTest extends TestCase {
assertEquals(3,vt100.getCursorColumn());
}
public void testVT100LineWrappingOn() {
ITerminalTextData term=makeITerminalTextData();
IVT100EmulatorBackend vt100=makeBakend(term);
term.setMaxHeight(10);
vt100.setDimensions(6, 4);
vt100.setVT100LineWrapping(true);
vt100.appendString("abcd");
vt100.setCursorColumn(0);
vt100.processNewline();
vt100.appendString("1234");
vt100.setCursorColumn(0);
vt100.processNewline();
assertEquals(2, vt100.getCursorLine());
}
public void testVT100LineWrappingOff() {
ITerminalTextData term=makeITerminalTextData();
IVT100EmulatorBackend vt100=makeBakend(term);
term.setMaxHeight(10);
vt100.setDimensions(6, 4);
vt100.setVT100LineWrapping(false);
vt100.appendString("abcd");
vt100.setCursorColumn(0);
vt100.processNewline();
vt100.appendString("1234");
vt100.setCursorColumn(0);
vt100.processNewline();
assertEquals(4, vt100.getCursorLine());
}
public void testWrappedLines() {
ITerminalTextData term=makeITerminalTextData();
IVT100EmulatorBackend vt100=makeBakend(term);
term.setMaxHeight(10);
vt100.setDimensions(6, 4);
vt100.setVT100LineWrapping(true);
vt100.appendString("abcd123");
vt100.setCursorColumn(0);
vt100.processNewline();
vt100.appendString("abc");
vt100.setCursorColumn(0);
vt100.processNewline();
vt100.appendString("1234abcd");
assertEquals(4, vt100.getCursorLine());
assertTrue(term.isWrappedLine(0));
assertFalse(term.isWrappedLine(1));
assertFalse(term.isWrappedLine(2));
assertTrue(term.isWrappedLine(3));
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
import junit.framework.TestCase;
@ -812,6 +813,20 @@ abstract public class AbstractITerminalTextDataTest extends TestCase {
fillSimple(term,start);
term.scroll(line, n, shift);
assertEqualsSimple(result, toSimple(term));
}
public void testWrappedLines() {
ITerminalTextData term=makeITerminalTextData();
term.setDimensions(4, 4);
for (int i=0; i<term.getHeight(); ++i)
assertFalse(term.isWrappedLine(i));
term.setWrappedLine(0);
term.setWrappedLine(3);
assertTrue(term.isWrappedLine(0));
assertFalse(term.isWrappedLine(1));
assertFalse(term.isWrappedLine(2));
assertTrue(term.isWrappedLine(3));
term.cleanLine(0);
assertFalse(term.isWrappedLine(0));
}
}

View file

@ -475,7 +475,20 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
ITerminalTextData data=new TerminalTextData();
fillSimple(data,"abcd");
term.copy(data);
}
public void testWrappedLines() {
ITerminalTextData term=makeITerminalTextData();
term.setDimensions(4, 4);
for (int i=0; i<term.getHeight(); ++i)
assertFalse(term.isWrappedLine(i));
term.setWrappedLine(0); // outside window
term.setWrappedLine(3);
assertFalse(term.isWrappedLine(0));
assertFalse(term.isWrappedLine(1));
assertFalse(term.isWrappedLine(2));
assertTrue(term.isWrappedLine(3));
term.cleanLine(3);
assertFalse(term.isWrappedLine(3));
}
}

View file

@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.view;singleton:=true
Bundle-Version: 2.4.100.qualifier
Bundle-Version: 2.4.200.qualifier
Bundle-Activator: org.eclipse.tm.internal.terminal.view.TerminalViewPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.3.0)"
org.eclipse.tm.terminal;bundle-version="[3.2.0,3.4.0)"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.view</artifactId>
<version>2.4.100.qualifier</version>
<version>2.4.200.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal; singleton:=true
Bundle-Version: 3.2.400.qualifier
Bundle-Version: 3.3.0.qualifier
Bundle-Activator: org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal</artifactId>
<version>3.2.400.qualifier</version>
<version>3.3.0.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -293,9 +293,7 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
int i=0;
while (i < chars.length) {
if(fWrapPending) {
doNewline();
line=toAbsoluteLine(fCursorLine);
setCursorColumn(0);
line = doLineWrap();
}
int n=Math.min(fColumns-fCursorColumn,chars.length-i);
fTerminal.setChars(line, fCursorColumn, chars, i, n, fStyle);
@ -308,10 +306,7 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
setCursorColumn(col - 1);
fWrapPending = true;
} else {
// immediate line wrapping
doNewline();
line=toAbsoluteLine(fCursorLine);
setCursorColumn(0);
line = doLineWrap();
}
} else {
setCursorColumn(col);
@ -320,6 +315,16 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
}
}
private int doLineWrap() {
int line;
line=toAbsoluteLine(fCursorLine);
fTerminal.setWrappedLine(line);
doNewline();
line=toAbsoluteLine(fCursorLine);
setCursorColumn(0);
return line;
}
/**
* MUST be called from a synchronized block!
*/

View file

@ -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
* are made available under the terms of the Eclipse synchronized public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
@ -97,4 +98,10 @@ public class SynchronizedTerminalTextData implements ITerminalTextData {
synchronized public void setMaxHeight(int height) {
fData.setMaxHeight(height);
}
synchronized public boolean isWrappedLine(int line) {
return fData.isWrappedLine(line);
}
synchronized public void setWrappedLine(int line) {
fData.setWrappedLine(line);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
@ -262,4 +263,12 @@ public class TerminalTextData implements ITerminalTextData {
fCursorLine=line;
sendCursorChanged();
}
public boolean isWrappedLine(int line) {
return fData.isWrappedLine(line);
}
public void setWrappedLine(int line) {
fData.setWrappedLine(line);
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
@ -246,5 +247,13 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
public void setCursorLine(int line) {
throw new UnsupportedOperationException();
}
public boolean isWrappedLine(int line) {
assert (line>=0 && line<fHeight) || throwRuntimeException();
return fData.isWrappedLine(getPositionOfLine(line));
}
public void setWrappedLine(int line) {
assert (line>=0 && line<fHeight) || throwRuntimeException();
fData.setWrappedLine(getPositionOfLine(line));
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
@ -294,6 +295,9 @@ class TerminalTextDataSnapshot implements ITerminalTextDataSnapshot {
public ITerminalTextData getTerminalTextData() {
return fTerminal;
}
public boolean isWrappedLine(int line) {
return fSnapshot.isWrappedLine(line);
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,11 +7,13 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import org.eclipse.tm.terminal.model.ITerminalTextData;
@ -31,6 +33,8 @@ public class TerminalTextDataStore implements ITerminalTextData {
private int fMaxHeight;
private int fCursorColumn;
private int fCursorLine;
final private BitSet fWrappedLines = new BitSet();
public TerminalTextDataStore() {
fChars=new char[0][];
fStyle=new Style[0][];
@ -75,8 +79,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
// clean the new lines
if(height>fHeight) {
for (int i = fHeight; i < height; i++) {
fStyle[i]=null;
fChars[i]=null;
cleanLine(i);
}
}
// set dimensions after successful resize!
@ -209,6 +212,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
for (int i = startLine; i < startLine+size+shift; i++) {
fChars[i]=fChars[i-shift];
fStyle[i]=fStyle[i-shift];
fWrappedLines.set(i, fWrappedLines.get(i-shift));
}
// then clean the opened lines
cleanLines(Math.max(startLine, startLine+size+shift),Math.min(-shift, getHeight()-startLine));
@ -217,6 +221,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
for (int i = startLine+size-1; i >=startLine && i-shift>=0; i--) {
fChars[i]=fChars[i-shift];
fStyle[i]=fStyle[i-shift];
fWrappedLines.set(i, fWrappedLines.get(i-shift));
}
cleanLines(startLine, Math.min(shift, getHeight()-startLine));
}
@ -228,8 +233,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
*/
private void cleanLines(int line, int len) {
for (int i = line; i < line+len; i++) {
fChars[i]=null;
fStyle[i]=null;
cleanLine(i);
}
}
@ -270,8 +274,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
fStyle=new Style[n][];
}
for (int i = 0; i < n; i++) {
fChars[i]=source.getChars(i);
fStyle[i]=source.getStyles(i);
copyLine(source, i, i);
}
fHeight=n;
fCursorLine=source.getCursorLine();
@ -279,14 +282,14 @@ public class TerminalTextDataStore implements ITerminalTextData {
}
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine,int length) {
for (int i = 0; i < length; i++) {
fChars[i+destStartLine]=source.getChars(i+sourceStartLine);
fStyle[i+destStartLine]=source.getStyles(i+sourceStartLine);
copyLine(source, i+sourceStartLine, i+destStartLine);
}
}
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
fChars[destLine]=source.getChars(sourceLine);
fStyle[destLine]=source.getStyles(sourceLine);
fWrappedLines.set(destLine, source.isWrappedLine(sourceLine));
}
public char[] getChars(int line) {
@ -304,6 +307,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
public void setLine(int line, char[] chars, Style[] styles) {
fChars[line]=(char[]) chars.clone();
fStyle[line]=(Style[]) styles.clone();
fWrappedLines.clear(line);
}
public void setMaxHeight(int height) {
@ -317,6 +321,7 @@ public class TerminalTextDataStore implements ITerminalTextData {
public void cleanLine(int line) {
fChars[line]=null;
fStyle[line]=null;
fWrappedLines.clear(line);
}
public int getCursorColumn() {
return fCursorColumn;
@ -330,4 +335,10 @@ public class TerminalTextDataStore implements ITerminalTextData {
public void setCursorLine(int line) {
fCursorLine=line;
}
public boolean isWrappedLine(int line) {
return fWrappedLines.get(line);
}
public void setWrappedLine(int line) {
fWrappedLines.set(line);
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.internal.terminal.model;
@ -194,4 +195,13 @@ public class TerminalTextDataWindow implements ITerminalTextData {
public void setCursorLine(int line) {
fData.setCursorLine(line);
}
public boolean isWrappedLine(int line) {
if(isInWindow(line))
return fData.isWrappedLine(line - fWindowStartLine);
return false;
}
public void setWrappedLine(int line) {
if(isInWindow(line))
fData.setWrappedLine(line - fWindowStartLine);
}
}

View file

@ -309,7 +309,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
text=""; //$NON-NLS-1$
}
buffer.append(text);
if(line < fSeletionEndLine)
if(line < fSeletionEndLine && !fSelectionSnapshot.getTerminalTextData().isWrappedLine(line))
buffer.append('\n');
}
return buffer.toString();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.terminal.model;
@ -71,20 +72,6 @@ public interface ITerminalTextData extends ITerminalTextDataReadOnly {
* @param line
*/
void cleanLine(int line);
// /**
// * @param line
// * @return true if this line belongs to the previous line but is simply
// * wrapped.
// */
// boolean isWrappedLine(int line);
//
// /**
// * Makes this line an extension to the previous line. Wrapped lines get folded back
// * when the width of the terminal changes
// * @param line
// * @param extendsPreviousLine
// */
// void setWrappedLine(int line, boolean extendsPreviousLine);
/**
* Shifts some lines up or down. The "empty" space is filled with <code>'\000'</code> chars
@ -151,4 +138,13 @@ public interface ITerminalTextData extends ITerminalTextDataReadOnly {
void setCursorLine(int line);
void setCursorColumn(int column);
/**
* Makes this line a wrapped line which logically continues on next line.
*
* @param line
* @since 3.3
*/
void setWrappedLine(int line);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend
* Anton Leherbauer (Wind River) - [453393] Add support for copying wrapped lines without line break
*******************************************************************************/
package org.eclipse.tm.terminal.model;
@ -73,4 +74,12 @@ public interface ITerminalTextDataReadOnly {
* @return the column at which the cursor is at the moment
*/
int getCursorColumn();
}
/**
* @param line
* @return true if this line got wrapped, ie. logically continues on next line
* @since 3.3
*/
boolean isWrappedLine(int line);
}