Browse Source

Channel linking improvements for commas

Fixes issue 3864
Unit test for issue 3864

Change-Id: Ie025d404d2d4eb80bc66aa0b7540ae67810907c9
Reviewed-on: http://gerrit.dmdirc.com/983
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4rc1
Chris Smith 14 years ago
parent
commit
05fa4bf932

+ 2
- 2
src/com/dmdirc/ui/messages/Styliser.java View File

@@ -81,7 +81,7 @@ public class Styliser implements ConfigChangeListener {
81 81
     /** Regexp to match characters which shouldn't be used in channel links. */
82 82
     private static final String RESERVED_CHARS = "[^\\s" + CODE_BOLD + CODE_COLOUR
83 83
             + CODE_STOP + CODE_HEXCOLOUR + CODE_FIXED + CODE_ITALIC
84
-            + CODE_UNDERLINE + CODE_CHANNEL + CODE_NICKNAME + CODE_NEGATE + "\"]";
84
+            + CODE_UNDERLINE + CODE_CHANNEL + CODE_NICKNAME + CODE_NEGATE + "\",]";
85 85
     
86 86
     /** Defines all characters treated as trailing punctuation that are illegal in URLs. */
87 87
     private static final String URL_PUNCT_ILLEGAL = "\"";
@@ -125,7 +125,7 @@ public class Styliser implements ConfigChangeListener {
125 125
             + HYPERLINK_CHARS + "]+?)([" + URL_PUNCT + "]?)([" + HYPERLINK_CHARS + "])";
126 126
     
127 127
     /** The regular expression to use for marking up channels. */
128
-    private static final String URL_CHANNEL = "(?i)(?<![^\\s\\+@\\-<>\\(\"'])([\\Q%s\\E]"
128
+    private static final String URL_CHANNEL = "(?i)(?<![^\\s\\+@\\-<>\\(\"',])([\\Q%s\\E]"
129 129
             + RESERVED_CHARS + "+)";
130 130
     
131 131
     /** Whether or not we should style links. */

+ 1
- 0
test/com/dmdirc/ui/messages/IntelligentLinkingTest.java View File

@@ -109,6 +109,7 @@ public class IntelligentLinkingTest {
109 109
             {"\"join #test\"", "\"join @#test@\""},
110 110
             {"'join #test'", "'join @#test@'"},
111 111
             {"#test.", "@#test@."},
112
+            {"#test1,#test2,#test3", "@#test1@,@#test2@,@#test3@"},
112 113
             {"(\"join #test!\")", "(\"join @#test@!\")"},
113 114
         };
114 115
 

Loading…
Cancel
Save