Re: fg via keybind modifies tty settings

2024-12-03 Thread Chet Ramey
On 11/27/24 10:54 PM, David Moberg wrote: Yes, if seems like the way to do this in bash. It's unfortunate because doing it with a binding is more elegant as it avoids polluting the terminal output and shell history. You don't have to put anything in the history you don't want to. If you don't

Re: fg via keybind modifies tty settings

2024-11-28 Thread Martin D Kealey
On Thu, 28 Nov 2024 at 13:54, David Moberg wrote: > Yes, if seems like the way to do this in bash. It's unfortunate because > doing it with a binding is more elegant as it avoids polluting the terminal > output and shell history. > You can avoid polluting history by inserting " fg\n" with a lead

Re: fg via keybind modifies tty settings

2024-11-27 Thread David Moberg
Yes, if seems like the way to do this in bash. It's unfortunate because doing it with a binding is more elegant as it avoids polluting the terminal output and shell history. In hindight: should the changes that were made to bash due to this discussion, be reverted? The previous behavior was less a

Re: fg via keybind modifies tty settings

2024-11-18 Thread Chet Ramey
On 11/16/24 5:29 AM, David Moberg wrote: Ok, is there anything I can do on my user side to get desired behavior? (similar to running `stty sane` every time I send vim to the background.) As several others have suggested, a simple macro that clears the line, saving the text on the kill ring for

Re: fg via keybind modifies tty settings

2024-11-17 Thread Martin D Kealey
On Wed, 13 Nov 2024 at 01:49, Chet Ramey 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. > > `Ordinar

Re: fg via keybind modifies tty settings

2024-11-17 Thread Martin D Kealey
On Sun, 17 Nov 2024 at 04:52, David Moberg wrote: > That looks very complicated, how do interpret that? And where/when to run > it? > To me this seems to have taken a wrong turn before the question was even asked. Just because readline has a "run a command" mode does NOT mean it's necessarily th

Re: fg via keybind modifies tty settings

2024-11-16 Thread #!microsuxx
so , this is using the logic that vim returns a specific code 148 on control-z checking $? for it is what i did , for your request .. that thats a bit more clear , we can go on with testing copypaste the first small code in a terminal and proceed with vim c-z testing the second longer is only fo

Re: fg via keybind modifies tty settings

2024-11-16 Thread #!microsuxx
ah and to save and have it copy it into .bash_profile or .profile On Sat, Nov 16, 2024, 9:15 PM #!microsuxx wrote: > so , this is using the logic that vim returns a specific code 148 on > control-z > checking $? for it is what i did , for your request .. > > that thats a bit more clear , we can

Re: fg via keybind modifies tty settings

2024-11-16 Thread David Moberg
That looks very complicated, how do interpret that? And where/when to run it? Den lör 16 nov. 2024 16:48#!microsuxx skrev: > trap ' t=$? ; [[ $BASH_COMMAND != *'$'bashcmd* ]] && bashcmd=$BASH_COMMAND > ' debug ; PROMPT_COMMAND=' [[ $t == 148 && $bashcmd == vim* ]] && echo ye > && stty sane ' > >

Re: fg via keybind modifies tty settings

2024-11-16 Thread #!microsuxx
trap ' t=$? ; [[ $BASH_COMMAND != *'$'bashcmd* ]] && bashcmd=$BASH_COMMAND ' debug ; PROMPT_COMMAND=' [[ $t == 148 && $bashcmd == vim* ]] && echo ye && stty sane ' On Sat, Nov 16, 2024, 4:40 PM #!microsuxx wrote: > PROMPT_COMMAND=' [[ $? == 148 ]] && stty sane ' > > On Sat, Nov 16, 2024, 11:29 A

Re: fg via keybind modifies tty settings

2024-11-16 Thread #!microsuxx
PROMPT_COMMAND=' [[ $? == 148 ]] && stty sane ' On Sat, Nov 16, 2024, 11:29 AM David Moberg wrote: > Ok, is there anything I can do on my user side to get desired behavior? > (similar to running `stty sane` every time I send vim to the background.) > > Den tis 12 nov. 2024 16:49Chet Ramey skrev

Re: fg via keybind modifies tty settings

2024-11-16 Thread David Moberg
Ok, is there anything I can do on my user side to get desired behavior? (similar to running `stty sane` every time I send vim to the background.) Den tis 12 nov. 2024 16:49Chet Ramey skrev: > On 11/10/24 7:14 PM, Martin D Kealey wrote: > > > Perhaps what's really needed is to make sure that "ord

Re: fg via keybind modifies tty settings

2024-11-12 Thread Chet Ramey
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 termi

Re: fg via keybind modifies tty settings

2024-11-10 Thread Martin D Kealey
On Fri, 8 Nov 2024 at 05:19, Chet Ramey wrote: > The bind -x execution code could restore the terminal settings to icanon > mode before executing the command, and then set them back to what readline > is using (-icanon) before returning. This is not backwards compatible > and would break all the

Re: fg via keybind modifies tty settings

2024-11-07 Thread Chet Ramey
On 11/5/24 1:21 AM, David Moberg wrote: Den ons 16 okt. 2024 17:43Chet Ramey > skrev: On 10/13/24 12:10 PM, David Moberg wrote: > A new issue popped up with these changes. After second time of suspend and > foreground with binding, the tty will no

Re: fg via keybind modifies tty settings

2024-11-04 Thread David Moberg
Den ons 16 okt. 2024 17:43Chet Ramey skrev: > On 10/13/24 12:10 PM, David Moberg wrote: > > A new issue popped up with these changes. After second time of suspend > and > > foreground with binding, the tty will not react to control keys but > instead > > print them on the prompt. > > In general,

Re: fg via keybind modifies tty settings

2024-10-16 Thread Chet Ramey
On 10/13/24 12:10 PM, David Moberg wrote: A new issue popped up with these changes. After second time of suspend and foreground with binding, the tty will not react to control keys but instead print them on the prompt. In general, this can't work, given a well-behaved process like vim that modi

Re: fg via keybind modifies tty settings

2024-10-13 Thread David Moberg
A new issue popped up with these changes. After second time of suspend and foreground with binding, the tty will not react to control keys but instead print them on the prompt. Repeat-By: | start vim ctrl-z (to suspend) ctrl-a (bound to `fg` to bring to foregound) ctrl-z (to suspend a 2nd t

Re: fg via keybind modifies tty settings

2024-10-12 Thread Lawrence Velázquez
On Sat, Oct 12, 2024, at 2:22 AM, David Moberg wrote: > So this kind of bugfix is not enough to ever trigger a new release on its > own? (sounds wise) No, but Chet does periodically release particularly important fixes as patches against the most recent release. (Those make up most of the commits

Re: fg via keybind modifies tty settings

2024-10-11 Thread David Moberg
Thanks! I would have tried it immediately if I knew about it. I will see if I'm able to try it on Monday. :) So this kind of bugfix is not enough to ever trigger a new release on its own? (sounds wise) Is there any cadence to releases or any other reason to expect a release at some point in the f

Re: fg via keybind modifies tty settings

2024-10-11 Thread Lawrence Velázquez
On Sat, Oct 12, 2024, at 1:43 AM, David Moberg wrote: > Oh, is this already fixed? Yes. > What am I looking at? The commit that fixed it. > This link shows a big commit to bash. Is it merged to main/release? No. It won't be until Chet releases 5.3. > Can I try it out? See Oğuz's message. >

Re: fg via keybind modifies tty settings

2024-10-11 Thread Oğuz
On Saturday, October 12, 2024, David Moberg wrote: > This link shows a big commit to bash. Is it merged to main/release? Can I > try it out? > You can clone the devel branch to try it out. The master branch is only updated for releases and important patches. -- Oğuz

Re: fg via keybind modifies tty settings

2024-10-11 Thread David Moberg
Oh, is this already fixed? What am I looking at? This link shows a big commit to bash. Is it merged to main/release? Can I try it out? The commit message is long, does it fix several issues at once? Den lör 12 okt. 2024 07:29Lawrence Velázquez skrev: > On Sat, Oct 12, 2024, at 1:11 AM, David M

Re: fg via keybind modifies tty settings

2024-10-11 Thread Lawrence Velázquez
On Sat, Oct 12, 2024, at 1:11 AM, David Moberg wrote: > Has anyone been able to take a more deep look? https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=254081c09767738833cdf161b4bc3feb1a51690a -- vq

Re: fg via keybind modifies tty settings

2024-10-11 Thread David Moberg
Has anyone been able to take a more deep look? Where in the bash source code would this happen? I learned that fish resets these kind of settings quite often. Den tis 24 sep. 2024 16:21Chet Ramey skrev: > On 9/20/24 7:23 PM, David Moberg wrote: > > > Bash Version: 5.2 > > Patch Level: 21 > > Re

Re: fg via keybind modifies tty settings

2024-09-24 Thread Chet Ramey
On 9/20/24 7:23 PM, David Moberg wrote: Bash Version: 5.2 Patch Level: 21 Release Status: release Description: When a process/job is suspended, foregrounded via ctrl-a as a keybinding for fg, and then suspended again, the tty will be in a surprising state where no input is see

Re: fg via keybind modifies tty settings

2024-09-22 Thread alex xmb sw ratchev
happened here with nvim and termux same as description On Sunday, September 22, 2024, Martin D Kealey wrote: > Does this happen with any raw-mode application, or just vim? > > When using readline in Emacs mode, the terminal is necessarily in raw mode. > > I suspect what you're seeing is that 'fg

Re: fg via keybind modifies tty settings

2024-09-21 Thread David Moberg
This happens for both vim and python3, I haven't tried with other applications. I'm not sure when readline and raw mode are activated, I would have to read up on that. Den sön 22 sep. 2024 02:39Martin D Kealey skrev: > Does this happen with any raw-mode application, or just vim? > > When using

Re: fg via keybind modifies tty settings

2024-09-21 Thread Martin D Kealey
Does this happen with any raw-mode application, or just vim? When using readline in Emacs mode, the terminal is necessarily in raw mode. I suspect what you're seeing is that 'fg' bound to a key is bypasses the normal "exit readline" that would restore the settings. Then when vim exits or is suspe

fg via keybind modifies tty settings

2024-09-20 Thread David Moberg
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-secu