Permalink
Browse files

show line returns and spaces in HTML

  • Loading branch information...
JPMoresmau committed Aug 3, 2012
1 parent 9d87dce commit 6e85e904ddd8d50b2940f37d689ee6fb432dbe58
@@ -15,6 +15,7 @@
import net.sf.eclipsefp.haskell.ui.internal.editors.haskell.imports.ImportsManager;
import net.sf.eclipsefp.haskell.ui.internal.preferences.editor.IEditorPreferenceNames;
import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;
+import net.sf.eclipsefp.haskell.util.PlatformUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.jface.text.BadLocationException;
@@ -103,8 +104,8 @@ public static String computeProblemInfo( final ITextViewer textViewer, final IRe
while (i.hasNext()) {
Annotation a = i.next();
String type = a.getType();
- if (fMarkerAnnotationAccess.isSubtype( type, ERROR_ANNOTATION_TYPE ) ||
- fMarkerAnnotationAccess.isSubtype( type, WARNING_ANNOTATION_TYPE )) {
+ if (a.getText()!=null && (fMarkerAnnotationAccess.isSubtype( type, ERROR_ANNOTATION_TYPE ) ||
+ fMarkerAnnotationAccess.isSubtype( type, WARNING_ANNOTATION_TYPE ))) {
Position p = annotationModel.getPosition( a );
if (p.overlapsWith( hoverRegion.getOffset(), hoverRegion.getLength() )) {
// add a nice icon
@@ -116,8 +117,14 @@ public static String computeProblemInfo( final ITextViewer textViewer, final IRe
} catch( IOException ioe){
HaskellUIPlugin.log( ioe );
}
+ String txt=a.getText();
+
+ txt=txt.replace( PlatformUtil.NL, "<br/>" );
+ txt=txt.replace( "\n", "<br/>" );
+ txt=txt.replace( "\r", "<br/>" );
+ txt=txt.replace( " ", "&nbsp;" );
return "<div style='font-family: verdana; padding:2px'>"+img+
- a.getText() +
+ txt +
"</div>";
}
}

0 comments on commit 6e85e90

Please sign in to comment.