On 2022-11-19 07:58:51 Uwe Brauer wrote:
Hi
When running
git log --graph --all --decorate --color=always --pretty=short| git name-rev --stdin|less
I see
- ESC[33mcommit 9dc21b3902a819796d1ba3bc7654733ab00e6e75
(feature)ESC[mESC[33m (ESC[mESC[36mHEADESC[mESC[33m -> ESC[mESC[32mfeature ESC[mESC[33m)ESC[m
However
git log --graph --all --decorate --color=always --pretty=short| git name-rev --stdin|less -R
Works as expected.
Any idea what is wrong in my setting (this happens in tcsh or bash shell)
Regards
Uwe Brauer
This is because of the default settings of the less command. In 'info less' we see that | -r or --raw-control-chars | Causes "raw" control characters to be displayed. The default is to display control characters | using the caret notation; for example, a control-A (octal 001) is displayed as "^A". Warning: | when the -r option is used, less cannot keep track of the actual appearance of the screen | (since this depends on how the screen responds to each type of control character). Thus, var- | ious display problems may result, such as long lines being split in the wrong place. | | USE OF THE -r OPTION IS NOT RECOMMENDED. | | -R or --RAW-CONTROL-CHARS | Like -r, but only ANSI "color" escape sequences and OSC 8 hyperlink sequences are output in | "raw" form. Unlike -r, the screen appearance is maintained correctly, provided that there are | no escape sequences in the file other than these types of escape sequences. Color escape se- | quences are only supported when the color is changed within one line, not across lines. In | other words, the beginning of each line is assumed to be normal (non-colored), regardless of | any escape sequences in previous lines. For the purpose of keeping track of screen appear- | ance, these escape sequences are assumed to not move the cursor.
For this reason, I use | alias l='/usr/bin/less --raw-control-chars' so that colouring works right in less. (Being lazy, I have shortened 'less' to 'l'. :-) )
Leslie -- Platform: GNU/Linux Hardware: x86_64 Distribution: openSUSE Leap 15.4 Desktop Environment: Trinity Qt: 3.5.0 TDE: R14.0.13 tde-config: 1.0