Skip to content

Commit 5c540c7

Browse files
committed
[lldb][gui] fix background of syntax-highlighted non-selected PC line
It is the PC line, selected or not, that gets the blue-background highlight. Without this, a keyword like 'bool' got black background if the line wasn't selected. And the blue-background highlight is handled by OutputColoredStringTruncated(), so no point in setting it explicitly in the calling code.
1 parent 11b6d2f commit 5c540c7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lldb/source/Core/IOHandlerCursesGUI.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6977,24 +6977,20 @@ class SourceFileWindowDelegate : public WindowDelegate {
69776977
}
69786978
}
69796979

6980-
const attr_t selected_highlight_attr = A_REVERSE;
6981-
const attr_t pc_highlight_attr = COLOR_PAIR(BlackOnBlue);
6982-
69836980
for (size_t i = 0; i < num_visible_lines; ++i) {
69846981
const uint32_t curr_line = m_first_visible_line + i;
69856982
if (curr_line < num_source_lines) {
69866983
const int line_y = m_min_y + i;
69876984
window.MoveCursor(1, line_y);
69886985
const bool is_pc_line = curr_line == m_pc_line;
69896986
const bool line_is_selected = m_selected_line == curr_line;
6990-
// Highlight the line as the PC line first, then if the selected
6991-
// line isn't the same as the PC line, highlight it differently
6987+
// Highlight the line as the PC line first (done by passing
6988+
// argument to OutputColoredStringTruncated()), then if the selected
6989+
// line isn't the same as the PC line, highlight it differently.
69926990
attr_t highlight_attr = 0;
69936991
attr_t bp_attr = 0;
6994-
if (is_pc_line)
6995-
highlight_attr = pc_highlight_attr;
6996-
else if (line_is_selected)
6997-
highlight_attr = selected_highlight_attr;
6992+
if (line_is_selected && !is_pc_line)
6993+
highlight_attr = A_REVERSE;
69986994

69996995
if (bp_lines.find(curr_line + 1) != bp_lines.end())
70006996
bp_attr = COLOR_PAIR(BlackOnWhite);
@@ -7023,7 +7019,7 @@ class SourceFileWindowDelegate : public WindowDelegate {
70237019
if (line.endswith("\n"))
70247020
line = line.drop_back();
70257021
bool wasWritten = window.OutputColoredStringTruncated(
7026-
1, line, m_first_visible_column, line_is_selected);
7022+
1, line, m_first_visible_column, is_pc_line);
70277023
if (!wasWritten && (line_is_selected || is_pc_line)) {
70287024
// Draw an empty space to show the selected/PC line if empty,
70297025
// or draw '<' if nothing is visible because of scrolling too much

0 commit comments

Comments
 (0)