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

Erase bottom line at exit #208

Closed Ximalas closed 1 year ago

Ximalas commented 1 year ago

It would be better if pspg can erase the bottom line of the terminal when exiting.

okbob commented 1 year ago

Can you describe more your idea? I am using pspg years from psql and I hadn't like this necessity.

How do you use pspg?

Ximalas commented 1 year ago

I run pspg from within psql, and to me it looks cleaner if the bottom line isn't a mix of the psql command prompt and the key hint bar when I exit pspg.

okbob commented 1 year ago

po 3. 10. 2022 v 18:19 odesílatel Ximalas @.***> napsal:

I run pspg from within psql, and to me it looks cleaner if the bottom line isn't a mix of the psql command prompt and the key hint bar when I exit pspg.

on my terminal pspg doesn't do this. Can you send screenshots? On my screenshots you can see the screen after leaving pspg, and there are not any key hints.

What is your platform? What is your terminal? I remember that some BSD platforms don't correctly implement alternate screen in terminals.

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/208#issuecomment-1265706721, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO46RMVOSA4MVH277AN3WBMBPRANCNFSM6AAAAAAQ3BMQGI . You are receiving this because you commented.Message ID: @.***>

Ximalas commented 1 year ago

I'm using FreeBSD current, MATE, Alacritty, and screen. See https://ximalas.info/~trond/pspg/pspg-001.png.

okbob commented 1 year ago

po 3. 10. 2022 v 20:29 odesílatel Ximalas @.***> napsal:

I'm using FreeBSD current, MATE, Alacritty, and screen. See https://ximalas.info/~trond/pspg/pspg-001.png.

Yes, I thought so.

https://unix.stackexchange.com/questions/235635/alternate-screen-on-freebsds-sc-and-vt

Maybe I will write some workarounds. Unfortunately, I am not BSD user, and I don't know usual design for this issue.

As workaround you can use option -X for pspg

export PSQL_PAGER="pspg -X" psql

It is not without unwanted visual artefacts, but it is better than without it (I think)

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/208#issuecomment-1265861682, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO4ZG3SU6PLZA66C4G6TWBMQ2FANCNFSM6AAAAAAQ3BMQGI . You are receiving this because you commented.Message ID: @.***>

Ximalas commented 1 year ago

Actually, -X isn't that bad. Yes, it strips off the colours when I hit the q key, but the bottom line is erased before psql displays its command prompt.

okbob commented 1 year ago

now you can use options --at-end-clean, --at-end-reset and --at-end-erase-line.

export PSQL_PAGER="pspg --at-end-erase-line" psql ...

please, check

Ximalas commented 1 year ago

I tried --at-end-erase-line and it's perfect. There is a typo for --at-end-erase-line in the help text, args.c, line 381. https://github.com/okbob/pspg/blob/master/src/args.c#L381

Ximalas commented 1 year ago

Maybe saying on exit is better than saying at end.

okbob commented 1 year ago

st 5. 10. 2022 v 19:19 odesílatel Ximalas @.***> napsal:

I tried --at-end-erase-line and it's perfect. There is a typo for --at-end-erase-line in the help text, args.c, line 381. https://github.com/okbob/pspg/blob/master/src/args.c#L381

should be fixed now

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/208#issuecomment-1268714583, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO46P3G2GKHMX5SSZBO3WBW2CJANCNFSM6AAAAAAQ3BMQGI . You are receiving this because you commented.Message ID: @.***>

okbob commented 1 year ago

st 5. 10. 2022 v 19:21 odesílatel Ximalas @.***> napsal:

Maybe saying at exit is better than saying at end.

good idea. I renamed these options to --on-exit-xxx

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/208#issuecomment-1268716081, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO42FKZELVBG6YYSFDEDWBW2HZANCNFSM6AAAAAAQ3BMQGI . You are receiving this because you commented.Message ID: @.***>

Ximalas commented 1 year ago

This looks good to me. I hope others find this as a useful change.

okbob commented 1 year ago

st 5. 10. 2022 v 20:31 odesílatel Ximalas @.***> napsal:

This looks good to me. I hope others find this as a useful change.

yes :-)

It can fix unwanted behave on some platforms

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/208#issuecomment-1268797040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO42DZA7TWJ3TZJRKV7LWBXCPRANCNFSM6AAAAAAQ3BMQGI . You are receiving this because you commented.Message ID: @.***>