mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
[168197] Fix Terminal for CDC-1.1/Foundation-1.1
This commit is contained in:
parent
c99db80573
commit
400e0612fa
7 changed files with 65 additions and 31 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#Fri Mar 28 14:14:24 CET 2008
|
||||
#Fri Apr 11 02:37:35 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
|
|
|
@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.ui
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.4
|
||||
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
|
||||
J2SE-1.4
|
||||
Bundle-ClassPath: .
|
||||
Export-Package: org.eclipse.tm.internal.terminal.connector;x-friends:="org.eclipse.tm.terminal.test",
|
||||
org.eclipse.tm.internal.terminal.control;x-friends:="org.eclipse.tm.terminal.view",
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
* Michael Scharf (Wing River) - [211659] Add field assist to terminal input field
|
||||
* Michael Scharf (Wing River) - [196447] The optional terminal input line should be resizeable
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.control;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -42,10 +42,10 @@ import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
|
|||
* <li>
|
||||
* <ul>Navigate with ARROW_UP,ARROW_DOWN,PAGE_UP,PAGE_DOWN
|
||||
* <ul>ESC to cancel history editing
|
||||
* <ul>History can be edited (by moving up and edit) but changes are
|
||||
* not persistent (like in bash).
|
||||
* <ul>If the same command is entered multiple times in a row,
|
||||
* only one entry is kept in the history.
|
||||
* <ul>History can be edited (by moving up and edit) but changes are
|
||||
* not persistent (like in bash).
|
||||
* <ul>If the same command is entered multiple times in a row,
|
||||
* only one entry is kept in the history.
|
||||
* </li>
|
||||
*
|
||||
*/
|
||||
|
@ -69,10 +69,10 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
}
|
||||
return (IContentProposal[]) result.toArray(new IContentProposal[result.size()]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private static class Proposal implements IContentProposal {
|
||||
|
||||
|
||||
private final String fContent;
|
||||
private final String fLabel;
|
||||
Proposal(String content, String label) {
|
||||
|
@ -82,15 +82,15 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
public String getContent() {
|
||||
return fContent;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return fLabel;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int getCursorPosition() {
|
||||
return fContent.length();
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fMaxSize=maxHistorySize;
|
||||
}
|
||||
/**
|
||||
* Add a line to the history.
|
||||
* Add a line to the history.
|
||||
* @param line The line to be added to the history.
|
||||
*/
|
||||
protected void pushLine(String line) {
|
||||
|
@ -143,7 +143,20 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fHistory.clear();
|
||||
if(history==null)
|
||||
return;
|
||||
fHistory.addAll(Arrays.asList(history.split("\n"))); //$NON-NLS-1$
|
||||
// add history entries separated by '\n'
|
||||
// fHistory.addAll(Arrays.asList(history.split("\n"))); //$NON-NLS-1$
|
||||
//<J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
int i = 0;
|
||||
int j = history.indexOf('\n');
|
||||
while (j > i) {
|
||||
fHistory.add(history.substring(i, j));
|
||||
do {
|
||||
j++;
|
||||
} while (j < history.length() && history.charAt(j) == '\n');
|
||||
i = j;
|
||||
j = history.indexOf('\n', i);
|
||||
}
|
||||
//</J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
}
|
||||
/**
|
||||
* @return the current content of the history buffer and new line separated list
|
||||
|
@ -218,7 +231,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
GridData gdata = (GridData) fInputField.getLayoutData();
|
||||
Rectangle sashRect = fSash.getBounds ();
|
||||
Rectangle containerRect = parent.getClientArea ();
|
||||
|
||||
|
||||
int h=fInputField.getLineHeight();
|
||||
// make sure the input filed hight is a multiple of the line height
|
||||
gdata.heightHint = Math.max(((containerRect.height-e.y-sashRect.height)/h)*h,h);
|
||||
|
@ -248,7 +261,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
new ContentAssistCommandAdapter(
|
||||
fInputField,
|
||||
new TextContentAdapter(),
|
||||
new FieldAssist(),
|
||||
new FieldAssist(),
|
||||
null,
|
||||
null,
|
||||
installDecoration);
|
||||
|
@ -295,6 +308,6 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fSash=null;
|
||||
fInputField.dispose();
|
||||
fInputField=null;
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
* Michael Scharf (Wind River) - split into core, view and connector plugins
|
||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.emulator;
|
||||
|
||||
|
@ -23,7 +24,6 @@ import java.io.InputStreamReader;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ControlListener;
|
||||
|
@ -839,10 +839,8 @@ public class VT100Emulator implements ControlListener {
|
|||
String positionReport = "\u001b[" + (relativeCursorLine() + 1) + ";" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
(getCursorColumn() + 1) + "R"; //$NON-NLS-1$
|
||||
|
||||
OutputStreamWriter streamWriter = new OutputStreamWriter(terminal
|
||||
.getOutputStream(), Charset.forName("ISO-8859-1")); //$NON-NLS-1$
|
||||
|
||||
try {
|
||||
OutputStreamWriter streamWriter = new OutputStreamWriter(terminal.getOutputStream(), "ISO-8859-1"); //$NON-NLS-1$
|
||||
streamWriter.write(positionReport, 0, positionReport.length());
|
||||
streamWriter.flush();
|
||||
} catch (IOException ex) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.model;
|
||||
|
||||
|
@ -54,7 +55,16 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
buff.append(term.getChar(line, column));
|
||||
}
|
||||
}
|
||||
return buff.toString().replaceAll("\000+", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
// get rid of the empty space at the end of the lines
|
||||
//return buff.toString().replaceAll("\000+", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
//<J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
int i = buff.length() - 1;
|
||||
while (i >= 0 && buff.charAt(i) == '\000') {
|
||||
i--;
|
||||
}
|
||||
buff.setLength(i + 1);
|
||||
return buff.toString();
|
||||
//</J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2008 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
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||
|
||||
|
@ -293,7 +294,14 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
if(line==fSelectionStartLine)
|
||||
text=text.substring(Math.min(fSelectionStartCoumn,text.length()));
|
||||
// get rid of the empty space at the end of the lines
|
||||
text=text.replaceAll("\000+$",""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
// text=text.replaceAll("\000+$",""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
// <J2ME-CDC-1.1 version>
|
||||
int i = text.length() - 1;
|
||||
while (i >= 0 && text.charAt(i) == '\000') {
|
||||
i--;
|
||||
}
|
||||
text = text.substring(0, i + 1);
|
||||
// </J2ME-CDC-1.1 version>
|
||||
// null means space
|
||||
text=text.replace('\000', ' ');
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue