# HG changeset patch # User František Kučera # Date 1422745420 -3600 # Node ID 087d8ec751098e8efc4ce32ed34686c8644dc239 # Parent 53fb05ce504c52b92470716252e742209f111e65 Tabular formatter: fix problem with CR (carriage return). Less command or orher programs shows it as ^M (two characters) and it breaks the table layout – so we need to translate it to a single symbol. diff -r 53fb05ce504c -r 087d8ec75109 java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java Sat Jan 31 23:40:31 2015 +0100 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java Sun Feb 01 00:03:40 2015 +0100 @@ -27,10 +27,14 @@ import java.util.regex.Pattern; /** - *

Prints human-readable output – tables of result sets and text messages with update counts.

+ *

+ * Prints human-readable output – tables of result sets and text messages with update counts. + *

* - *

Longer values might break the table – overflow the cells – see alternative tabular formatters - * and the {@linkplain #PROPERTY_TRIM} property.

+ *

+ * Longer values might break the table – overflow the cells – see alternative tabular formatters + * and the {@linkplain #PROPERTY_TRIM} property. + *

* * @author Ing. František Kučera (frantovo.cz) * @see TabularPrefetchingFormatter @@ -45,7 +49,7 @@ public static final String PROPERTY_COLORFUL = "color"; public static final String PROPERTY_TRIM = "trim"; private static final String NBSP = " "; - private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\t|" + NBSP); + private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\r|\\t|" + NBSP); protected ColorfulPrintWriter out; private boolean firstResult = true; private int[] columnWidth; @@ -282,6 +286,9 @@ case "\n": out.print(TerminalColor.Red, "↲"); break; + case "\r": + out.print(TerminalColor.Red, "⏎"); + break; case "\t": out.print(TerminalColor.Red, "↹"); break;