okbob / pspg

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.
BSD 2-Clause "Simplified" License
2.43k stars 85 forks source link

Feature: Handle long columns. Add option for max column width, and keybindings to scroll within the long column, etc. #227

Closed 0-issue closed 1 year ago

0-issue commented 1 year ago

I tried pspg on some more real world datasets. If a column has long text data in some rows, the entire column is sized to the width greater than maximum length of text in that column. In a dataset I tested, that a column had text that was few thousand characters, which made scrolling to the left and right of that column very difficult. Proposal:

  1. Add an option to specify max column width, and allow setting it when pspg is running with nifty keybindings/mouse.
  2. Add a keybinding to scroll left-right within the select cell.
  3. Add a visual cue in cells that have more text to the right, like arrow character to left and/or right edge of a cell where there is more text in either direction.
okbob commented 1 year ago

Hi

st 5. 7. 2023 v 6:53 odesílatel amanvm @.***> napsal:

I tried pspg on some more real world datasets. If a column has long text data in some rows, the entire column is sized to the width greater than maximum length of text in that column. In a dataset I tested, that a column had text that was few thousand characters, which made scrolling to the left and right of that column very difficult. Proposal:

  1. Add an option to specify max column width, and allow setting it when pspg is running with nifty keybindings/mouse.
  2. Add a keybinding to scroll left-right within the select cell.
  3. Add a visual cue in cells that have more text to the right, like arrow character to left and/or right edge of a cell where there is more text in either direction.

This is pretty hard to implement in the text console. I can imagine implementing max column width used for csv formatting. More advanced features are not possible in pspg. You should use the "left" function for long strings in SQL query. pspg is almost pager, it cannot do dynamic changes of output format.

For scrolling with long columns the pspg has some possibilities

KEY_LEFT, h scroll to left KEY_RIGHT, l scroll to right Ctrl+KEY_LEFT scroll one char left Ctrl+KEY_RIGHT scroll one char right Shift+KEY_LEFT scroll one column left Shift+KEY_RIGHT scroll one column right

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO43JBUX73IYPX3ROFOTXOTXMTANCNFSM6AAAAAAZ6NDM24 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

okbob commented 1 year ago

I wrote support for new options csv-trim-width and csv-trim-rows 24a7688cea67274ddcf783c0e92011aba7c98dcf