Repository navigation
Echo typed input in interactive ghostel-compile runs - #591
Merged
Merged
Conversation
Interactive input worked in compile buffers but typed characters never appeared: the PTY was always spawned with -echo, and the C-c C-j toggle only swapped keymaps without touching termios. Spawn interactive runs with echo on, and flip ECHO out-of-band on the live PTY when toggling mid-run. The toggle leaves echo off when the tty is in non-canonical mode (a full-screen program owns the display) or the cursor row matches ghostel-password-prompt-regex (the pty state cannot distinguish a program-set -echo from the spawn default, but the prompt text can). Compilation-style runs keep -echo so terminal query replies don't render as garbage in the log.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Interactive input worked in
ghostel-compilebuffers, but typed characters never appeared: the PTY was always spawned with-echo, and theC-c C-jtoggle (ghostel-compile-switch-to-interactive) only swapped keymaps without touching termios. Typing at aread-style prompt was invisible.Fix
C-u M-x ghostel-compile) configure the PTY withghostel--default-stty(echo on), so input is visible from the first keystroke.sttyagainstprocess-tty-name(Emacs has no termios API). Local runs only — for TRAMP the process tty is the local connection pty, not the remote pty the command reads from.ghostel-password-prompt-regex— the pty state cannot distinguish a program-set-echo(ssh, sudo,read -s) from the compile spawn default, but the prompt text can. Typed secrets must not render into the buffer.-echo: the buffer is a pure log, and echoed terminal query replies (DA1, DSR, OSC color reports) would render as escape-sequence garbage.Known residual: a password prompt whose text doesn't match the regex and is already on screen at toggle time gets echoed — the same residual every comint-based mode has.
Tests
Four new native tests: interactive spawn echoes typed input before the program responds (the script blocks in
read, so the text can only come from tty echo), the toggle enables echo mid-run, the raw-mode guard leaves a TUI's terminal alone, and aPassword:prompt keeps ECHO off across the toggle. Test markers are assembled from printf fragments so the command line echoed in the buffer header can't satisfy the wait predicates.Verified live in a TTY Emacs: typed input echoes at the prompt (including DEL erase), and typing at a password prompt after
C-c C-jrenders nothing while still reaching the program.