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 1708f142472270c
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
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Mon Jan 20 23:58:57 2014 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Tue Jan 21 00:11:04 2014 +0100
     1.3 @@ -44,7 +44,8 @@
     1.4  	public static final String PROPERTY_ASCII = "ascii";
     1.5  	public static final String PROPERTY_COLORFUL = "color";
     1.6  	public static final String PROPERTY_TRIM = "trim";
     1.7 -	private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\t");
     1.8 +	private static final String NBSP = " ";
     1.9 +	private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\t|" + NBSP);
    1.10  	protected ColorfulPrintWriter out;
    1.11  	private boolean firstResult = true;
    1.12  	private int[] columnWidth;
    1.13 @@ -284,6 +285,9 @@
    1.14  				case "\t":
    1.15  					out.print(TerminalColor.Red, "↹");
    1.16  					break;
    1.17 +				case NBSP:
    1.18 +					out.print(TerminalColor.Red, "⎵");
    1.19 +					break;
    1.20  				default:
    1.21  					throw new IllegalStateException("Unexpected whitespace token: „" + m.group() + "“");
    1.22  			}