1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 219589 - [terminal] "Copy" is disabled when an entire line is selected

This commit is contained in:
Martin Oberhuber 2010-08-19 13:37:08 +00:00
parent 43d8cdb34b
commit 315b6942fc
5 changed files with 12 additions and 7 deletions

View file

@ -13,7 +13,7 @@
<feature
id="org.eclipse.tm.terminal"
label="%featureName"
version="3.0.200.qualifier"
version="3.0.201.qualifier"
provider-name="%providerName">
<description>

View file

@ -13,7 +13,7 @@
<feature
id="org.eclipse.tm.terminal.sdk"
label="%featureName"
version="3.1.0.qualifier"
version="3.1.1.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">

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.0.100.qualifier
Bundle-Version: 3.0.101.qualifier
Bundle-Activator: org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 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) - [219589] Copy an entire line selection
*******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas;
@ -281,7 +282,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
* @return the currently selected text
*/
private String extractSelectedText() {
if(fSelectionStartLine<0 || fSelectionStartCoumn<0 || fSelectionEndColumn<0 || fSelectionSnapshot==null)
if(fSelectionStartLine<0 || fSelectionStartCoumn<0 || fSelectionSnapshot==null)
return ""; //$NON-NLS-1$
StringBuffer buffer=new StringBuffer();
for (int line = fSelectionStartLine; line <= fSeletionEndLine; line++) {
@ -289,7 +290,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
char[] chars=fSelectionSnapshot.getChars(line);
if(chars!=null) {
text=new String(chars);
if(line==fSeletionEndLine)
if(line==fSeletionEndLine && fSelectionEndColumn >= 0)
text=text.substring(0, Math.min(fSelectionEndColumn+1,text.length()));
if(line==fSelectionStartLine)
text=text.substring(Math.min(fSelectionStartCoumn,text.length()));

View file

@ -12,6 +12,7 @@
* Martin Oberhuber (Wind River) - [294327] After logging in, the remote prompt is hidden
* Anton Leherbauer (Wind River) - [294468] Fix scroller and text line rendering
* Uwe Stieber (Wind River) - [205486] Fix ScrollLock always moving to line 1
* Anton Leherbauer (Wind River) - [219589] Copy an entire line selection
*******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas;
@ -163,7 +164,10 @@ public class TextCanvas extends GridCanvas {
if (fDraggingStart !=null && !p.equals(fDraggingEnd)) {
fDraggingEnd = p;
if (compare(p, fDraggingStart) < 0) {
fCellCanvasModel.setSelection(p.y, fDraggingStart.y, p.x, fDraggingStart.x);
// bug 219589 - make sure selection start coordinates are non-negative
int startColumn = Math.max(0, p.x);
int startRow = Math.max(p.y, 0);
fCellCanvasModel.setSelection(startRow, fDraggingStart.y, startColumn, fDraggingStart.x);
} else {
fCellCanvasModel.setSelection(fDraggingStart.y, p.y, fDraggingStart.x, p.x);