dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
85 stars 12 forks source link

growlight-readline leaves echo disabled on exit #87

Closed dankamongmen closed 3 years ago

dankamongmen commented 3 years ago

1) start up growlight-readline 1.2.13 2) exit 3) characters are not echoed :(

dankamongmen commented 3 years ago

I bet this is due to readline interaction. Yuck.

dankamongmen commented 3 years ago
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_TKILL, si_pid=87875, si_uid=0} ---
write(1, "\33[0m\17\33[38;2;0;0;9m\33[39;49m", 26) = 26
write(1, "\33[0m\17", 5)                = 5
write(1, "\33]104\7", 6)                = 6
write(17, "\33[?25h", 6)                = 6
ioctl(17, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(17, SNDCTL_TMR_START or TCSETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(17, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0

well, there you go. We have echo enabled, then disable it as the last thing we do (note the or TCSETS in the second ioctl() line).

dankamongmen commented 3 years ago

OK, ncdirect_init() is putting us into cbreak mode, and readline is also disabling echo. If readline_prep_term() precedes ncdirect_init(), we get echo while executing, but not after running. If readline_prep_term() follows ncdirect_init(), we get echo post-execution, but not while executing...

dankamongmen commented 3 years ago

So yeah, readline_prep_term() definitely disables echo. If ncdirect_init() then runs, it sees -echo. If ncdirect_init() runs first, readline for whatever reason doesn't echo things back (presumably because echo was disabled on entry, duh). So maybe the best way to resolve this is add an ncdirect flag to disable the cbreak_input()...

dankamongmen commented 3 years ago

https://github.com/dankamongmen/notcurses/issues/1049 in Notcurses 1.7.6 will give us the necessary capability.