glab mr list leaves terminal in broken state (no input echo / alternate screen) after quitting pager
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "bug" label: - https://gitlab.com/gitlab-org/cli/-/issues/?label_name%5B%5D=type%3A%3Abug and verify the issue you're about to submit isn't a duplicate. ---> ### Checklist <!-- Please test the latest versions, that will remove the possibility that you see a bug that is fixed in a newer version. --> - [x] I'm using the latest version of the extension (Run `glab --version`) - Extension version: glab 1.99.0 (a9ab75a4) - [x] Operating system and version: - Distributor ID: Pop - Description: Pop!_OS 22.04 LTS - Release: 22.04 - Codename: jammy - [x] Gitlab.com or self-managed instance? self-managed instance - [x] GitLab version (if self-managed) 16.11.10 - [x] I have performed `glab auth status` to check for authentication issues - [x] Run the command in debug mode (like `DEBUG=true glab mr list`) and attach any useful output ### Summary When running glab mr list (which spawns a pager like less) quitting the pager can leave the terminal in a broken state: input is not echoed, cursor/prompt may be missing, and normal typing is invisible. Running reset restores the terminal. ### Environment - OS: Linux 6.17.9-76061709-generic x86_64 - SHELL: /bin/bash - TERM: xterm-256color - GLAB: glab 1.99.0 (a9ab75a4) Other: I use oh-my-bash. ### Steps to reproduce 1. In an interactive bash session (local or over SSH) with a repo that pages MR output: - Ensure GLAB_PAGER/PAGER are unset or set to less -R. 2. Run: `glab mr list` 3. When the pager starts, press `q` to quit and press `enter` (`q` is not enough). ### What is the current _bug_ behavior? Typed input not echoed (invisible), prompt may not display; reset required to recover. ### What is the expected _correct_ behavior? Pager exits cleanly and the terminal state (echo, alternate screen) is fully restored. No manual reset needed. ### Relevant logs and/or screenshots Non working commands with same behavior of mr list: - glab issue list - glab release list - glab cluster agent list - glab runner list Working commands that share PAGER are: - glab user events - glab mr view - glab mr diff - glab issue view [issue id] - glab repo view Extra info - less version: 590, but tested also with 692 - stty before/after reproduce: Before: ``` speed 38400 baud; rows 73; columns 318; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc ``` After: ``` speed 38400 baud; rows 73; columns 318; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc ``` icanon -> -icanon ; echo -> -echo ### Workaround - type `reset` after exiting the list - glab mr list --no-pager - GLAB_PAGER=cat glab mr list
issue