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

Tom Tromey
2022-07-15T19:40:46Z

>>>>> "Andrei" == Andrei Pikas <gdb@mail.api.win> writes:

Andrei> Adds the ability to customize the colors of the current line of code in TUI.
Andrei> This may be desirable when code highlighting is enabled. Because higlighted
Andrei> keywords in dark blue color are indistinguishable from a black background
Andrei> (which is the default inverse color for a white terminal).
Andrei> Here is a screenshot of old and new behavior
Andrei> https://drive.google.com/file/d/1BbgNwpFa0DvKX0K9UAd48dEgtn8aChXP/view

Thank you for the patch.

Andrei> +set style tui-cursorline foreground COLOR
Andrei> +set style tui-cursorline background COLOR

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.

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?

Andrei> +static bool
Andrei> +get_custom_cursorline_style (ui_file_style *style)
Andrei> +{

Please add an introductory comment explaining the purpose of the
function.

Andrei> + ui_file_style cursorline_style = tui_cursorline_style.style();

Space before "(". There are a couple instances of this here.

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.

Tom