Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 386472 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/internal/text/SelectionProcessor.java (-1 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2010 Avaloq Evolution AG and others.
2
 * Copyright (c) 2009, 2012 Avaloq Evolution AG and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
package org.eclipse.jface.internal.text;
11
package org.eclipse.jface.internal.text;
12
12
13
import java.util.Arrays;
13
import java.util.Arrays;
14
15
import org.eclipse.swt.graphics.GC;
14
16
15
import org.eclipse.core.runtime.Assert;
17
import org.eclipse.core.runtime.Assert;
16
18
Lines 487-492 Link Here
487
		 *         <code>[0,fTabWidth]</code>
489
		 *         <code>[0,fTabWidth]</code>
488
		 */
490
		 */
489
		private int visualSizeIncrement(char character, int visual) {
491
		private int visualSizeIncrement(char character, int visual) {
492
			if (fGC != null && character > 255)
493
				return (int)Math.ceil(fGC.stringExtent(new String(Character.toString(character))).x / fSingleCharWidth);
490
			if (character != '\t')
494
			if (character != '\t')
491
				return 1;
495
				return 1;
492
			if (fTabWidth <= 0)
496
			if (fTabWidth <= 0)
Lines 503-508 Link Here
503
507
504
	private ISelectionProvider fSelectionProvider;
508
	private ISelectionProvider fSelectionProvider;
505
509
510
	private GC fGC;
511
512
	float fSingleCharWidth;
513
514
506
	/**
515
	/**
507
	 * Creates a new processor on the given viewer.
516
	 * Creates a new processor on the given viewer.
508
	 * 
517
	 * 
Lines 510-515 Link Here
510
	 */
519
	 */
511
	public SelectionProcessor(ITextViewer viewer) {
520
	public SelectionProcessor(ITextViewer viewer) {
512
		this(viewer.getDocument(), viewer.getTextWidget().getTabs());
521
		this(viewer.getDocument(), viewer.getTextWidget().getTabs());
522
		fGC= new GC(viewer.getTextWidget());
523
		fSingleCharWidth= fGC.stringExtent(" ").x; //$NON-NLS-1$
524
513
		if (viewer instanceof ITextViewerExtension) {
525
		if (viewer instanceof ITextViewerExtension) {
514
			ITextViewerExtension ext= (ITextViewerExtension)viewer;
526
			ITextViewerExtension ext= (ITextViewerExtension)viewer;
515
			fRewriteTarget= ext.getRewriteTarget();
527
			fRewriteTarget= ext.getRewriteTarget();

Return to bug 386472