[PATCH v2 (mentions of reverse mode eliminated)] Add style tui-cursorline command to colorize TUI current line.

Andrei Pikas gdb@mail.api.win
Fri Jul 15 22:06:34 GMT 2022


 > I think I'd prefer a hyphen in there, since "cursorline" isn't a word.
 > So, tui-cursor-line.  But why "cursor" and not "current"? "current
 > line" seems to be the term used in the gdb manual.

I chose this name to match vim for those who familiar with :set 
cursorline. OK, I'll change it to tui-cursor-line. Or would you prefer 
tui-current-line?



 > Andrei> @@ -54,6 +54,28 @@ static const char * const cli_colors[] = {
 > Andrei>    "magenta",
 > Andrei>    "cyan",
 > Andrei>    "white",
 > Andrei> +  "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", 
"18", "19", "20",
 >
 > What's this for?

This is to support all 256 colors 
https://www.ditig.com/256-colors-cheat-sheet . I want to use the 
lightest shade of gray #255 for the background.


 > Andrei>      case '\n':
 > Andrei> +          if (wattr_get (w, &w_attrs, &w_pair, nullptr) == OK)
 > Andrei> +            /* Apply current style till the end of line. */
 > Andrei> +            wchgat (w, -1, w_attrs, w_pair, nullptr);
 >
 > I don't think this is correct, because the source window may not extend
 > to the end of the line.

I tested for long line. It doesn't seem to be a problem (screenshot 
https://drive.google.com/file/d/1lMgdR9cTNEQJAz05wO7TCgd3SVYOdXyP/view?usp=sharing 
).

I think -1 handles this case: "A character count of -1 or greater than 
the remaining window width means to change attributes all the way to the 
end of the current line." from https://linux.die.net/man/3/wchgat

I can rewrite this line as wchgat (w, std::max (0, getmaxx (w) - getcurx 
(w)), w_attrs, w_pair, nullptr). But I think it's the same.


More information about the Gdb-patches mailing list