diff options
2 files changed, 28 insertions, 5 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java index 3216f8e2afe..cff9634b1ff 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation 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 @@ -124,7 +124,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation int maxNumberOfLines= Math.round(maxHeight / gc.getFontMetrics().getHeight()); fCounter= 0; - LineBreakingReader reader= new LineBreakingReader(createReader(hoverInfo, presentation), gc, maxWidth); + LineBreakingReader reader= new LineBreakingReader(createReader(hoverInfo, presentation), hoverInfo.length(), gc, maxWidth); boolean lastLineFormatted= false; String lastLineIndent= null; diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java index 480591cf73b..4bfebf2ac8c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java @@ -36,13 +36,36 @@ public class LineBreakingReader { /** * Creates a reader that breaks an input text to fit in a given width. - * - * @param reader Reader of the input text + * + * @param reader reader for the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixels) where the text has to fit in */ public LineBreakingReader(Reader reader, GC gc, int maxLineWidth) { - fReader= new BufferedReader(reader); + this(new BufferedReader(reader), gc, maxLineWidth); + } + + /** + * Creates a reader that breaks an input text to fit in a given width. + * + * @param reader the reader for the input text + * @param bufferSize the buffer size + * @param gc The graphic context that defines the currently used font sizes + * @param maxLineWidth The max width (pixels) where the text has to fit in + */ + public LineBreakingReader(Reader reader, int bufferSize, GC gc, int maxLineWidth) { + this(new BufferedReader(reader, bufferSize), gc, maxLineWidth); + } + + /** + * Creates a reader that breaks an input text to fit in a given width. + * + * @param reader the buffered reader for the input text + * @param gc The graphic context that defines the currently used font sizes + * @param maxLineWidth The max width (pixels) where the text has to fit in + */ + private LineBreakingReader(BufferedReader reader, GC gc, int maxLineWidth) { + fReader= reader; fGC= gc; fMaxWidth= maxLineWidth; fOffset= 0; |