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.45k stars 85 forks source link

unable to properly search #178

Closed mzagrabe closed 3 years ago

mzagrabe commented 3 years ago

Greetings,

Thank you for pspg! I am using 4.1.0 on Debian.

I type '/' to search and the cursor moves to the footer with a '/' in front of it.

I type a search string, for instance "role", and then hit and nothing happens. I type "n" and then on the search line, it shows "rolen". I don't know how to signal to pspg that I'd like to search for the string.

Ctrl + C cancels out of the search functionality.

Thank you for the help!

okbob commented 3 years ago

It is strange. The problem can be inside interface between readline library and pspg. Looks so readline doesn't ending. Normally pspg sending \n to readline, and then readline signalise end of editing. I have no idea why this mechanism doesn't work on your Debian.

First, please, can you check some fresh release? This part was more time modified from 4.1.0.

mzagrabe commented 3 years ago

Hi Pavel,

It looks like the issue is with my readline rc file (~/.inputrc). In that file I have:

Control-j: next-history

Which both the emacs and vi mode have:

"C-J" accept-line

So... I'm not sure why other readline applications (psql!) are able to use for accept-line and still allow my personal configuration for next-history.

Any thoughts?

mzagrabe commented 3 years ago

So... I'm not sure why other readline applications (psql!) are able to use for accept-line and still allow my personal configuration for next-history.

The github application scrubbed out the word "ENTER" from above. It should read:

I'm not sure why other readline applications (psql!) are able to use ENTER for accept-line and still allow my personal configuration for next-history.

okbob commented 3 years ago

čt 8. 7. 2021 v 21:19 odesílatel Matt Zagrabelny @.***> napsal:

So... I'm not sure why other readline applications (psql!) are able to use for accept-line and still allow my personal configuration for next-history.

The github application scrubbed out the word "ENTER" from above. It should read:

I'm not sure why other readline applications (psql!) are able to use ENTER for accept-line and still allow my personal configuration for next-history.

Readline allows two modes of usage - more usual is first, where the readline reads chars from stdin directly. This mode is used by psql. pspg uses second mode, when pspg reads data from /dev/tty and resends these chars to readline. Next - pspg check some callback calls used by readline for signalization of end of edit mode. So usage of readline in pspg is very different from using in psql. psql is an REPL application - pspg is full screen ncurses application with more complex input stream processing - because it is pager, and then usually interactive input is not stdin but /dev/tty.

Maybe I missed some configuration call of readline - unfortunately readline is a pretty complex and heavy library. But it can be a bug in the readline in the second mode that is used by pspg. I expect only a few applications use this mode.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/178#issuecomment-876683791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO45HJMOWNOYJUGNJRFDTWX23PANCNFSM477MY7XQ .

okbob commented 3 years ago

Probably I fixed it - the core of this issue was in default "nl" mode. In this mode the application is not able to detect ENTER. "nonl" mode should to fix it.

mzagrabe commented 3 years ago

Hi Pavel,

I pulled the changes and recompiled. Searching works now (by using ENTER) with my customized readline configs.

Thanks for coding up the fix!

-m

On Tue, Jul 13, 2021 at 11:03 AM Pavel Stehule @.***> wrote:

Probably I fixed it - the core of this issue was in default "nl" mode. In this mode the application is not able to detect ENTER. "nonl" mode should to fix it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/178#issuecomment-879212117, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKKRUUHIW23TDVDGPIFEDTXRPTLANCNFSM477MY7XQ .

okbob commented 3 years ago

út 13. 7. 2021 v 21:24 odesílatel Matt Zagrabelny @.***> napsal:

Hi Pavel,

I pulled the changes and recompiled. Searching works now (by using ENTER) with my customized readline configs.

Thanks for coding up the fix!

super :)

Thank you for report

Pavel

-m

On Tue, Jul 13, 2021 at 11:03 AM Pavel Stehule @.***> wrote:

Probably I fixed it - the core of this issue was in default "nl" mode. In this mode the application is not able to detect ENTER. "nonl" mode should to fix it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/178#issuecomment-879212117, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABBKKRUUHIW23TDVDGPIFEDTXRPTLANCNFSM477MY7XQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/178#issuecomment-879341020, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO44ZJWU4DQ33SQWNNB3TXSHGZANCNFSM477MY7XQ .