Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dde8e11

Browse files
fixes #140 - Do not suppress multiple consecutive spaces
1 parent 155f3d7 commit dde8e11

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.java

+7
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,13 @@ private String getLinkedAndFormattedText(final String text) {
923923
localText = localText.substring(0, start) + title + localText.substring(end);
924924
m = p3.matcher(localText);
925925
}
926+
// replaces two consecutive spaces with two non-breaking spaces to fix #140
927+
// assume that consecutive spaces do not conflict with previous replacements
928+
// using CSS "white-space: pre-wrap;" does not work within Swing, it's simply ignored.
929+
// See https://docs.oracle.com/javase/8/docs/api/javax/swing/text/html/CSS.html
930+
// putting text in pre tags is not an option, because this suppresses wrap.
931+
localText = localText.replaceAll(" ", "  ");
932+
// add paragraph for each line to preserve line breaks
926933
StringBuilder sb = new StringBuilder();
927934
for (final String p : localText.split("\n")) {
928935
sb.append("<p>");

0 commit comments

Comments
 (0)