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

ESC-q broken on MacOS #204

Closed
hunsakerbn opened this issue Jul 26, 2022 · 9 comments
Closed

ESC-q broken on MacOS #204

hunsakerbn opened this issue Jul 26, 2022 · 9 comments

Comments

@hunsakerbn
Copy link

hunsakerbn commented Jul 26, 2022

On MacOS the ALT/OPTION key used with another keyboard key sends unicode characters rather than ESC-. For example I have to explicitly hit ESC-q to 'quit and print raw (unformatted) content' as ALT-q sends 'œ'.

When I upgraded to the latest version, this broke unless I can manage to hit ESC-q really really fast. Apparently the 2 second timeout for this to happen is no longer working.

I used the following attached patch (there's probably a better way) to fix the problem:
inputs.c.patch.txt

I install/upgrade pspg via homebrew.

@okbob
Copy link
Owner

okbob commented Jul 29, 2022

What version of pspg do you use? I check the master branch, and there the 2seconds limit is broken.

@hunsakerbn
Copy link
Author

hunsakerbn commented Jul 29, 2022

% pspg --version
pspg-5.5.5
with readline (version: 0x0801)
with integrated menu
ncurses version: 6.3, patch: 20211021
ncurses with wide char support
ncurses widechar num: 0
wchar_t width: 4, max: 2147483647
with postgres client integration
with kqueue support

I install and update via 'hombrew' on MacOS.

% sw_vers
ProductName: macOS
ProductVersion: 12.4
BuildVersion: 21F79

@okbob
Copy link
Owner

okbob commented Jul 30, 2022

I don't understand why you changed expression nced->keycode == PSPG_NOTASSIGNED_CODE to nced->keycode == -1. It looks like some different behavior of macos :-(. Please, can you test commit 1e69572 with option --log=file.txt Some like ./pspg -f tests/pg_class.txt --log=log.txt. When you press ESC, then there should be line in log like unexpected error ESC N str. Please, can me send the number and string?

@hunsakerbn
Copy link
Author

Here is the log output:

Mon Aug 1 09:11:51 2022 [18322] started
Mon Aug 1 09:11:51 2022 [18322] with utf8 support
Mon Aug 1 09:11:51 2022 [18322] esc delay = -1
Mon Aug 1 09:11:51 2022 [18322] DataDesc is initialized
Mon Aug 1 09:11:51 2022 [18322] next row will be data row
Mon Aug 1 09:11:51 2022 [18322] next row will be desc row
Mon Aug 1 09:11:51 2022 [18322] read rows 347
Mon Aug 1 09:11:51 2022 [18322] read input 347 rows
Mon Aug 1 09:11:51 2022 [18322] terminal size by TIOCGWINSZ rows: 56, cols: 97
Mon Aug 1 09:11:51 2022 [18322] ncurses started
Mon Aug 1 09:11:51 2022 [18322] kmous=\E[M, TERM=xterm-kitty
Mon Aug 1 09:11:51 2022 [18322] xterm mouse mode 1002 will be used
Mon Aug 1 09:11:51 2022 [18322] xterm mouse mode 1002 activated
Mon Aug 1 09:11:51 2022 [18322] initial stdscr size - maxy: 56, maxx: 97
Mon Aug 1 09:11:55 2022 [18322] unexpected error ESC: Undefined error: 0 (0)
Mon Aug 1 09:12:00 2022 [18322] process command: RawOutputQuit
Mon Aug 1 09:12:00 2022 [18322] releasing cmd bar before end
Mon Aug 1 09:12:00 2022 [18322] xterm mouse mode 1002 is deactivated
Mon Aug 1 09:12:00 2022 [18322] ncurses ended
Mon Aug 1 09:12:00 2022 [18322] correct quit

@okbob
Copy link
Owner

okbob commented Aug 1, 2022 via email

okbob added a commit that referenced this issue Aug 1, 2022
@okbob
Copy link
Owner

okbob commented Aug 1, 2022

please, can you check last commit?

@hunsakerbn
Copy link
Author

Latest commit fixes the problem. It seems like the ESC delay is more than 2 seconds, perhaps infinite? (esc delay = -1).
I waited about 10 seconds between hitting escape and 'q' and still got 'RawOutputQuit'.

Testing with './pspg -f tests/pg_class.txt --log=log.txt --esc-delay=2000' works with a 2 second delay.

@okbob okbob closed this as completed Aug 2, 2022
@okbob
Copy link
Owner

okbob commented Oct 11, 2022 via email

@okbob
Copy link
Owner

okbob commented Oct 11, 2022 via email

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