IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/widgets/JosmHTMLEditorKit.java b/src/org/openstreetmap/josm/gui/widgets/JosmHTMLEditorKit.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.widgets; |
| 3 | 3 | |
| | 4 | import javax.swing.text.BadLocationException; |
| | 5 | import javax.swing.text.Document; |
| 4 | 6 | import javax.swing.text.ViewFactory; |
| | 7 | import javax.swing.text.html.HTMLDocument; |
| 5 | 8 | import javax.swing.text.html.HTMLEditorKit; |
| 6 | 9 | import javax.swing.text.html.StyleSheet; |
| 7 | 10 | |
| | 11 | import org.openstreetmap.josm.tools.TextUtils; |
| | 12 | |
| 8 | 13 | /** |
| 9 | 14 | * A subclass of {@link HTMLEditorKit} that fixes an uncommon design choice that shares the set stylesheet between all instances. |
| 10 | 15 | * This class stores a single stylesheet per instance, as it should have be done by Sun in the first place. |
| … |
… |
|
| 51 | 56 | public ViewFactory getViewFactory() { |
| 52 | 57 | return FACTORY; |
| 53 | 58 | } |
| | 59 | |
| | 60 | @Override |
| | 61 | public Document createDefaultDocument() { |
| | 62 | StyleSheet styles = getStyleSheet(); |
| | 63 | StyleSheet ss = new StyleSheet(); |
| | 64 | |
| | 65 | ss.addStyleSheet(styles); |
| | 66 | |
| | 67 | HTMLDocument doc = new UrlHTMLDocument(ss); |
| | 68 | doc.setParser(getParser()); |
| | 69 | doc.setAsynchronousLoadPriority(4); |
| | 70 | doc.setTokenThreshold(100); |
| | 71 | return doc; |
| | 72 | } |
| | 73 | |
| | 74 | private static class UrlHTMLDocument extends HTMLDocument { |
| | 75 | UrlHTMLDocument(StyleSheet ss) { |
| | 76 | super(ss); |
| | 77 | } |
| | 78 | |
| | 79 | @Override |
| | 80 | public String getText(int offset, int length) throws BadLocationException { |
| | 81 | String original = super.getText(offset, length); |
| | 82 | return TextUtils.unwrapLongUrl(original); |
| | 83 | } |
| | 84 | } |
| 54 | 85 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/tools/TextUtils.java b/src/org/openstreetmap/josm/tools/TextUtils.java
|
a
|
b
|
|
| 20 | 20 | public static String wrapLongUrl(String url) { |
| 21 | 21 | return url.replace("/", "/\u200b").replace("&", "&\u200b"); |
| 22 | 22 | } |
| | 23 | |
| | 24 | /** |
| | 25 | * Remove zero width space character (U+8203) after each slash/ampersand to wrap long URLs. |
| | 26 | * @param url URL |
| | 27 | * @return unwrapped URL |
| | 28 | * @since xxx |
| | 29 | */ |
| | 30 | public static String unwrapLongUrl(String url) { |
| | 31 | return url.replace("/\u200b", "/").replace("&\u200b", "&"); |
| | 32 | } |
| 23 | 33 | } |