diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2023-02-03 07:56:09 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2023-02-12 10:26:12 +0100 |
| commit | ec4b87b34a5f180b3613abcc7714c6d8ceb36dd3 (patch) | |
| tree | c34fa672cb1a93002ab2654510cf18df6261e1c5 /.emacs.d | |
| parent | b3c2ffbf9edbbdd6bd6cb1769543c4093f15f835 (diff) | |
| download | dotfiles-ec4b87b34a5f180b3613abcc7714c6d8ceb36dd3.tar.xz | |
Give up on colored PS4
The first mistake here was to forget to wrap console codes with \[…\];
for some reason though after adding those…
export PS4=$(echo -en '\[\e[7m\]+ \[\e[0m\]')
… bash no longer repeats the first character (+) according to the
indirection level, or rather, it repeats an entirely unrelated
character:
$ ( PS4='+ ' ; set -x ; echo $(echo $(echo hi | grep hi)) )
+++ echo hi
+++ grep --color=auto hi
++ echo hi
+ echo hi
hi
$ ( PS4=$(echo -en '\[\e[7m\]+ \[\e[0m\]')
set -x
echo $(echo $(echo hi | grep hi))
) |& hexdump -C
00000000 01 01 01 1b 5b 37 6d 02 2b 20 01 1b 5b 30 6d 02 |....[7m.+ ..[0m.|
^^ ^^ ^^ (echo)
00000010 65 63 68 6f 20 68 69 0a 01 01 01 1b 5b 37 6d 02 |echo hi.....[7m.|
^^ ^^ ^^ (grep)
00000020 2b 20 01 1b 5b 30 6d 02 67 72 65 70 20 2d 2d 63 |+ ..[0m.grep --c|
00000030 6f 6c 6f 72 3d 61 75 74 6f 20 68 69 0a 01 01 1b |olor=auto hi....|
^^ ^^ (echo)
00000040 5b 37 6d 02 2b 20 01 1b 5b 30 6d 02 65 63 68 6f |[7m.+ ..[0m.echo|
00000050 20 68 69 0a 01 1b 5b 37 6d 02 2b 20 01 1b 5b 30 | hi...[7m.+ ..[0|
^^ (echo)
00000060 6d 02 65 63 68 6f 20 68 69 0a 68 69 0a |m.echo hi.hi.|
0000006d
No idea where those ^A characters come from.
While at it, wrap PS2 to avoid line-wrapping shenanigans.
Diffstat (limited to '.emacs.d')
0 files changed, 0 insertions, 0 deletions
