TabularFormatter: values with line ends will not break our tables v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 30 Dec 2013 23:46:41 +0100
branchv_0
changeset 1035410b6afc839
parent 102 ff47349e24bf
child 104 245f1b88a3e6
TabularFormatter: values with line ends will not break our tables
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 Dec 30 15:50:05 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Mon Dec 30 23:46:41 2013 +0100
     1.3 @@ -141,7 +141,14 @@
     1.4  			printTableBorder(" │ ");
     1.5  		}
     1.6  
     1.7 -		out.print(TerminalColor.Cyan, toString(value));
     1.8 +		String[] valueParts = toString(value).split("\n");
     1.9 +		for (int i = 0; i < valueParts.length; i++) {
    1.10 +			String valuePart = valueParts[i];
    1.11 +			out.print(TerminalColor.Cyan, valuePart);
    1.12 +			if (i < valueParts.length - 1) {
    1.13 +				out.print(TerminalColor.Red, "↲");
    1.14 +			}
    1.15 +		}
    1.16  
    1.17  		if (isCurrentColumnLast()) {
    1.18  			printTableBorder(" │");