Revision: 7465
http://languagetool.svn.sourceforge.net/languagetool/?rev=7465&view=rev
Author: dnaber
Date: 2012-06-22 20:54:55 +0000 (Fri, 22 Jun 2012)
Log Message:
-----------
bugfix: duplicate spaces where detected but had no error color background in
our GUI
Modified Paths:
--------------
trunk/JLanguageTool/src/java/org/languagetool/gui/ContextTools.java
trunk/JLanguageTool/src/test/org/languagetool/gui/ContextToolsTest.java
Modified: trunk/JLanguageTool/src/java/org/languagetool/gui/ContextTools.java
===================================================================
--- trunk/JLanguageTool/src/java/org/languagetool/gui/ContextTools.java
2012-06-22 18:58:39 UTC (rev 7464)
+++ trunk/JLanguageTool/src/java/org/languagetool/gui/ContextTools.java
2012-06-22 20:54:55 UTC (rev 7465)
@@ -72,9 +72,11 @@
final int endMark = markerStr.lastIndexOf('^');
String result = sb.toString();
if (escapeHtml) {
+ final String escapedErrorPart =
StringTools.escapeHTML(result.substring(startMark, endMark + 1))
+ .replace(" ", " "); // make sure whitespace errors are
visible
result = StringTools.escapeHTML(result.substring(0, startMark))
+ errorMarkerStart
- + StringTools.escapeHTML(result.substring(startMark, endMark + 1))
+ + escapedErrorPart
+ errorMarkerEnd + StringTools.escapeHTML(result.substring(endMark +
1));
} else {
result = result.substring(0, startMark) + errorMarkerStart
Modified:
trunk/JLanguageTool/src/test/org/languagetool/gui/ContextToolsTest.java
===================================================================
--- trunk/JLanguageTool/src/test/org/languagetool/gui/ContextToolsTest.java
2012-06-22 18:58:39 UTC (rev 7464)
+++ trunk/JLanguageTool/src/test/org/languagetool/gui/ContextToolsTest.java
2012-06-22 20:54:55 UTC (rev 7465)
@@ -26,6 +26,8 @@
final ContextTools contextTools = new ContextTools();
final String context = contextTools.getContext(4, 8, "Hi, this is some
nice text waiting for its error markers.");
assertEquals("Hi, <b><font bgcolor=\"#ff8b8b\">this</font></b> is some
nice text waiting for its error...", context);
+ final String context2 = contextTools.getContext(3, 5, "xxx\n \nyyy");
+ assertEquals("xxx<b><font bgcolor=\"#ff8b8b\"> </font></b>
yyy", context2);
}
public void testLargerContext() throws Exception {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs