On 2023-11-01 23:08:53 +0100, Vincent Lefevre wrote:
> "crontab -l" still incorrectly outputs a yellow background color where
> it shouldn't: when scrolling is involved[*], the trailing whitespace
> in a line that follows a comment (possibly the prompt line) has a
> yellow background.
In crontab.c:
while (EOF != (ch = get_char(f)))
switch (ch) {
case '\b':
putchar('\\'); putchar('b'); break;
case '\r':
putchar('\\'); putchar('r'); break;
default:
if(new_line && isatty(STDOUT)){
if(ch == '#'){
printf(COMMENT_COLOR);
} else {
printf(RESET_COLOR);
}
}
putchar(ch);
new_line = ch == '\n';
}
I think that the issue is that the RESET_COLOR is sent *after*
the \n. Why???
If sent after, the following line will also have the comment
background in case of scrolling. If sent before, this should
be OK in most cases, but perhaps not if there is a line whose
number of characters is equal to the terminal width.
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)