Tabular: replace also Non-breaking space with colored symbol (like newlines and TABs) v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 21 Jan 2014 00:11:04 +0100
branchv_0
changeset 170 8f142472270c
parent 169 4e131a0b521a
child 171 701ec4db43fb
Tabular: replace also Non-breaking space with colored symbol (like newlines and TABs)
java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java
--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Mon Jan 20 23:58:57 2014 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Tue Jan 21 00:11:04 2014 +0100
@@ -44,7 +44,8 @@
 	public static final String PROPERTY_ASCII = "ascii";
 	public static final String PROPERTY_COLORFUL = "color";
 	public static final String PROPERTY_TRIM = "trim";
-	private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\t");
+	private static final String NBSP = " ";
+	private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\t|" + NBSP);
 	protected ColorfulPrintWriter out;
 	private boolean firstResult = true;
 	private int[] columnWidth;
@@ -284,6 +285,9 @@
 				case "\t":
 					out.print(TerminalColor.Red, "↹");
 					break;
+				case NBSP:
+					out.print(TerminalColor.Red, "⎵");
+					break;
 				default:
 					throw new IllegalStateException("Unexpected whitespace token: „" + m.group() + "“");
 			}