View | Details | Raw Unified | Return to bug 517358 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/AbstractTextCanvasModel.java (-11 / +18 lines)
Lines 277-282 abstract public class AbstractTextCanvasModel implements ITextCanvasModel { Link Here
277
	public String getSelectedText() {
277
	public String getSelectedText() {
278
		return fCurrentSelection;
278
		return fCurrentSelection;
279
	}
279
	}
280
281
	// helper to sanitize text copied out of a snapshot
282
	private static String scrubLine(String text) {
283
		if (text == null || text.length() == 0) {
284
			return ""; //$NON-NLS-1$
285
		}
286
		// get rid of the empty space at the end of the lines
287
		int i = text.length() - 1;
288
		while (i >= 0 && text.charAt(i) == '\000') {
289
			i--;
290
		}
291
		text = text.substring(0, i + 1);
292
		// </J2ME-CDC-1.1 version>
293
		// null means space
294
		return text.replace('\000', ' ');
295
	}
296
280
	/**
297
	/**
281
	 * Calculates the currently selected text
298
	 * Calculates the currently selected text
282
	 * @return the currently selected text
299
	 * @return the currently selected text
Lines 294-310 abstract public class AbstractTextCanvasModel implements ITextCanvasModel { Link Here
294
					text=text.substring(0, Math.min(fSelectionEndColumn+1,text.length()));
311
					text=text.substring(0, Math.min(fSelectionEndColumn+1,text.length()));
295
				if(line==fSelectionStartLine)
312
				if(line==fSelectionStartLine)
296
					text=text.substring(Math.min(fSelectionStartCoumn,text.length()));
313
					text=text.substring(Math.min(fSelectionStartCoumn,text.length()));
297
				// get rid of the empty space at the end of the lines
314
				text=scrubLine(text);
298
				// text=text.replaceAll("\000+$","");  //$NON-NLS-1$//$NON-NLS-2$
299
				// <J2ME-CDC-1.1 version>
300
				int i = text.length() - 1;
301
				while (i >= 0 && text.charAt(i) == '\000') {
302
					i--;
303
				}
304
				text = text.substring(0, i + 1);
305
				// </J2ME-CDC-1.1 version>
306
				// null means space
307
				text=text.replace('\000', ' ');
308
			} else {
315
			} else {
309
				text=""; //$NON-NLS-1$
316
				text=""; //$NON-NLS-1$
310
			}
317
			}

Return to bug 517358