Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes)
- X-seq: zsh-workers 51136
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Millian Poquet <millian.poquet@xxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Get cursor position (Was: [bug report] prompt can erase messages written on the terminal by background processes)
- Date: Thu, 8 Dec 2022 10:10:54 +0000
- Archived-at: <https://zsh.org/workers/51136>
- In-reply-to: <20221208100215.k2qcqdqgjlzwbdh7@chazelas.org>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Millian Poquet <millian.poquet@xxxxxxx>, zsh-workers@xxxxxxx
- References: <9e3026aa-39a1-dd50-4d29-a64724d4eaaf@irit.fr> <CAN=4vMq2kc1cSV_0N-c6o32C3UR3hVSjE3mF+kV4pjcy7YR9=g@mail.gmail.com> <CAH+w=7aDn7SCv4Bao7ZQqtUaEv8EkvBXa15kM_nkF_GHLAcSFg@mail.gmail.com> <20221208082103.zg44mrv77jrizsaj@chazelas.org> <CAN=4vMrSO99rKMGhmO_yjtqYLUf+senu=Lhb=F47a9S6y8d7Hw@mail.gmail.com> <20221208100215.k2qcqdqgjlzwbdh7@chazelas.org>
2022-12-08 10:02:15 +0000, Stephane Chazelas:
[...]
> (bash does by exploiting some bug (calling unset -v in a
> severate function peels one layer of scoping instead of
> unsetting in the current scope)).
[...]
Not sure how "separate" became "severate" there. Sometimes it
feels like my fingers have a life of their own... Sorry.
unlocal in bash (or yash) can be written:
unlocal() { unset -v "$@"; }
(that's one of the main reasons POSIX couldn't specify "local"
btw).
It's worse in mksh where unset is always unlocal.
$ bash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g: 1
f: 3
$ yash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g: 1
f: 3
$ zsh -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
$ dash -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
$ bosh -c 'unlocal() { unset -v "$@"; }; f() { local a=1; g; echo "f: $a"; }; g() { local a=2; unlocal a; echo "g: $a"; a=3; }; a=0; f'
g:
f: 1
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author