Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Move single column to the left & right #192

Closed
muhmud opened this issue Oct 18, 2021 · 10 comments
Closed

Feature Request: Move single column to the left & right #192

muhmud opened this issue Oct 18, 2021 · 10 comments

Comments

@muhmud
Copy link

muhmud commented Oct 18, 2021

It would be great to be able to move a single column to the left and right.

I would propose using Ctrl + h / KEY_LEFT and Ctrl + l / KEY_RIGHT for these movements.

@okbob
Copy link
Owner

okbob commented Oct 18, 2021 via email

@muhmud
Copy link
Author

muhmud commented Oct 18, 2021

I think maybe I didn't state this clearly: I mean it should move one terminal character to the left & right, regardless of how columns are drawn.

@okbob
Copy link
Owner

okbob commented Oct 18, 2021 via email

@muhmud
Copy link
Author

muhmud commented Oct 18, 2021

Sure, can do, however, if you look at the man page for less, it's basically the same functionality as the [-# shift] option with a value of 1, but only applied when the Ctrl key is used.

What I would like is to keep the existing functionality of h and l as it is, but if Ctrl h or Ctrl l is used, then only move by a single column position.

If it still doesn't make sense, please let me know & I'll do an ASCII diagram

@muhmud
Copy link
Author

muhmud commented Oct 21, 2021

Take a look at the attached file from sqlcmd (MSSQL Server) for an example of where I'm having issues. The last column TABLE_TYPE can be difficult to catch, though it seems better in less.

It would also be great if pspg could somehow clean up the output to remove the wasted space, though I suspect this might be difficult...

mssql.txt

@okbob
Copy link
Owner

okbob commented Oct 28, 2021

I implemented one char horizontal scrolling controlled by ^left and ^right. I cannot to use ^h and ^l, because ^l is used for different purpose already. See commit 945d783

Unfortunately pspg cannot to reformat original document. It is just pager. If your client can print data in csv format, then pspg can read data in csv format and can do internal formatting to table. It was used as workaround for older slow table formatting in pgcli (already fixed), or it is used for sqlite.

@muhmud
Copy link
Author

muhmud commented Oct 28, 2021

Thanks @okbob , just tried it out & it works great, though only in xterm. I normally use st and none of the Ctrl-based shortcuts work for me. I'll have to try and sit down with it to figure out why, as the reported escape codes are the same in both.

I worked around the formatting issue by preprocessing the output in perl before passing it to pspg, and making it look like it came from postgres, which works pretty well. I didn't know about the CSV functionality, that's pretty useful, thanks for that 👍

@okbob
Copy link
Owner

okbob commented Oct 28, 2021

Maybe terminfo for st terminal is not good, or maybe your TERM specification has some issue.

Unfortunately - escape sequences and related codes can be different - pspg uses ncurses terminfo database, and when the configuration of TERM is not correct, or data in terminfo database is not current, then it can be broken.

@muhmud
Copy link
Author

muhmud commented Oct 30, 2021

Yep, I think it's something like that; we can close this issue now if you like

@okbob
Copy link
Owner

okbob commented Oct 30, 2021

ok :)

@okbob okbob closed this as completed Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants