Skip to content

Commit

Permalink
[lldb][gui] underline the current token
Browse files Browse the repository at this point in the history
Just like the non-gui listing already does.
  • Loading branch information
llunak committed Apr 3, 2022
1 parent 5e79a00 commit baebf23
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lldb/source/Core/IOHandlerCursesGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,11 @@ class Surface {
// This is written to match our Highlighter classes, which seem to
// generate only foreground color escape sequences. If necessary, this
// will need to be extended.
// Only 8 basic foreground colors and reset, our Highlighter doesn't use
// anything else.
// Only 8 basic foreground colors, underline and reset, our Highlighter
// doesn't use anything else.
int value;
if (!!string.consumeInteger(10, value) || // Returns false on success.
!(value == 0 ||
!(value == 0 || value == ANSI_CTRL_UNDERLINE ||
(value >= ANSI_FG_COLOR_BLACK && value <= ANSI_FG_COLOR_WHITE))) {
llvm::errs() << "No valid color code in color escape sequence.\n";
continue;
Expand All @@ -542,6 +542,8 @@ class Surface {
wattr_set(m_window, saved_attr, saved_pair, nullptr);
if (use_blue_background)
::wattron(m_window, COLOR_PAIR(WhiteOnBlue));
} else if (value == ANSI_CTRL_UNDERLINE) {
::wattron(m_window, A_UNDERLINE);
} else {
// Mapped directly to first 16 color pairs (black/blue background).
::wattron(m_window, COLOR_PAIR(value - ANSI_FG_COLOR_BLACK + 1 +
Expand Down Expand Up @@ -7013,7 +7015,12 @@ class SourceFileWindowDelegate : public WindowDelegate {
window.AttributeOn(highlight_attr);

StreamString lineStream;
m_file_sp->DisplaySourceLines(curr_line + 1, {}, 0, 0, &lineStream);

llvm::Optional<size_t> column;
if (is_pc_line && m_sc.line_entry.IsValid() && m_sc.line_entry.column)
column = m_sc.line_entry.column - 1;
m_file_sp->DisplaySourceLines(curr_line + 1, column, 0, 0,
&lineStream);
StringRef line = lineStream.GetString();
if (line.endswith("\n"))
line = line.drop_back();
Expand Down

0 comments on commit baebf23

Please sign in to comment.