On Thu, 26 Feb 2015 10:58:30 +0000
Adam Podstawczy?ski <adam at podstawczynski.com> wrote:

> While this solves the issue for me, I still believe this behavior is
> confusing ? truncated characters should be handled more gracefully.

To your point, I think the column and column-width features of the
shell could benefit from some re-thinking.  

My ~/.sqliterc includes these lines:

        .mode column
        .header ON

and truncated strings and numbers are a source of confusion and error
even though I know how they work.  

I wish that by default column formatting would be "soft" in the sense
that printf(1) and printf(3) define: digits to the left of the decimal
are never truncated, and strings are not truncated unless explicitly
requested:  

$ printf '%5.4f\n' 123456789.123456789
123456789.1235
$ printf '%5.4s\n' 123456789.123456789
 1234

This would make the output "snakey" on the screen sometimes, but would
never conceal important information.  

I would change the width specification to accept the width and
precision notation used by printf.  The statement 

        .width 8

would mean "set the minimum column width to 8", whereas

        .width  8.8  

would mean "set the minumum width to 8, minimum precision to 8, and
truncate strings to 8".  I wouldn't worry about columns that mix
strings and numbers; funny-looking strings in that case should be
expected.  And, besides, don't do that.  

It would also be nice to have a mode ".autowidth" that set column
widths based on, say, the first 10 lines (and, preferably, their
labels) in a manner similar to column(1).  Provided it never truncated
anything, I would use that more often than an improved .width.

Thoughts?

--jkl


Reply via email to