[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fg via keybind modifies tty settings
From: |
Martin D Kealey |
Subject: |
Re: fg via keybind modifies tty settings |
Date: |
Mon, 18 Nov 2024 14:23:15 +1000 |
On Wed, 13 Nov 2024 at 01:49, Chet Ramey <chet.ramey@case.edu> wrote:
> On 11/10/24 7:14 PM, Martin D Kealey wrote:
>
> > Perhaps what's really needed is to make sure that "ordinary" commands
> bound
> > using bash -x are completely broken (so people won't try to use them),
> > rather than almost working.
>
> `Ordinary' commands aren't broken. Programs like vim that modify the
> terminal settings, which are in the minority, are.
>
Fixing things for 'vim', will likely break them for me. That's why I'm
suggesting that there needs to be two separate ways of "binding an
invocable command". For many commands it won't matter which one you use,
but for
I have a use case where I do NOT want the stty settings to be restored
after running a command from a key binding, because it would defeat the
point:
bind -x '"\C-_": stty tostop'
This enables me to hit ctrl-7 (same key as '&') to temporarily turn on
TOSTOP in termios.c_lflags, to prevent the output of a background command
from messing up the line I'm currently editing (and vice versa). (The
choice of key or escape sequence isn't important; it's the effect of stty
that matters.)
Currently it only lasts as long as it takes me to type the current command,
which is useful but not critical. Here's an example transcript; please take
note of the timestamps in the prompt:
> 11:47:44 3$ bind -x '"\C-_": stty tostop'
> 11:48:02 4$ stty -a | grep -o .tostop
> -tostop
> 11:51:11 5$ (sleep 5 ; echo Hello)&
> [1] 21951
> 11:51:25 6$ echo Hi* # at this point I hit ctrl-7 and then wait a while
> before hitting enter; note the absence of intermingling*
> Hi
>
> [1]+ Stopped ( sleep 5; echo Hello )
> 11:51:35 7$ bg
> [1]+ ( sleep 5; echo Hello ) &
> Hello
> [1]+ Done ( sleep 5; echo Hello )
> 11:51:38 8$ stty -a | grep -o .tostop
> -tostop
>
-Martin
- Re: fg via keybind modifies tty settings, (continued)
- Re: fg via keybind modifies tty settings, David Moberg, 2024/11/16
- Re: fg via keybind modifies tty settings, #!microsuxx, 2024/11/16
- Re: fg via keybind modifies tty settings, #!microsuxx, 2024/11/16
- Re: fg via keybind modifies tty settings, David Moberg, 2024/11/16
- Re: fg via keybind modifies tty settings, #!microsuxx, 2024/11/16
- Re: fg via keybind modifies tty settings, #!microsuxx, 2024/11/16
- Re: fg via keybind modifies tty settings, Martin D Kealey, 2024/11/17
- Re: fg via keybind modifies tty settings, Chet Ramey, 2024/11/18
- Re: fg via keybind modifies tty settings, David Moberg, 2024/11/27
- Re: fg via keybind modifies tty settings, Martin D Kealey, 2024/11/28
- Re: fg via keybind modifies tty settings,
Martin D Kealey <=