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

Skip to content

Commit cbf1cd8

Browse files
Merge pull request #141 from utPLSQL/bugfix/issue-140-preserve-ws
Bugfix #140 - Do not suppress multiple consecutive spaces
2 parents 55f7540 + dde8e11 commit cbf1cd8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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>");

sqldev/src/test/resources/test.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# properties to connect to Oracle Database using JDBC thin driver
2-
host=localhost
2+
host=fillmore
33
port=1521
44
service=odb.docker
55

0 commit comments

Comments
 (0)