From 5757c92613f66caa6d6215a5d089e9efdd4ecf32 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 4 Mar 2025 11:19:15 -0800 Subject: fullscreen: use eval to improve appearance of suspended job. There is a difference between Bash 4 and Bash 5. When a command which has been invoked by syntax like: command "$@" is suspended by Ctrl-Z, Bash 4 shows, as the displayed job string, the real program that is running, and its arguents. Whereas Bash 5 just shows the above unexpanded 'command "$@"' syntax! To work around this, we expand "$@" ourselves, and eval an expanded command. * basta.sh (basta.fullscreen): Expand the command arguments into a properly escaped variable with the help of the %q argument of printf. Then we eval the command. We keep the LINES=$realrows out of the command, putting that into the eval, otherwise that will appear in the jobs also. The cosmetics is improved. For instance if the Bash 5 user has an alias like "alias vim='basta.fullscreen vim'", and then runs "vim file" and suspends the editor into the background, they will see "command vim file" as the job name, rather than LINES=$realrows command "$@". --- basta.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basta.sh b/basta.sh index 5367c68..b920abd 100644 --- a/basta.sh +++ b/basta.sh @@ -332,7 +332,8 @@ basta.fullscreen() printf $'\e7\e[1;%sr\e8' $realrows >&$ttyfd stty rows $realrows <&$ttyfd - LINES=$realrows command "$@" || exit=$? + local args=$(printf "%q " "$@") + LINES=$realrows eval command $args || exit=$? if [ $saveterm ] ; then printf $'\e[?1049l' >&$ttyfd -- cgit v1.2.3