Skip to content

Commit baebf23

Browse files
committed
[lldb][gui] underline the current token
Just like the non-gui listing already does.
1 parent 5e79a00 commit baebf23

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lldb/source/Core/IOHandlerCursesGUI.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,11 @@ class Surface {
524524
// This is written to match our Highlighter classes, which seem to
525525
// generate only foreground color escape sequences. If necessary, this
526526
// will need to be extended.
527-
// Only 8 basic foreground colors and reset, our Highlighter doesn't use
528-
// anything else.
527+
// Only 8 basic foreground colors, underline and reset, our Highlighter
528+
// doesn't use anything else.
529529
int value;
530530
if (!!string.consumeInteger(10, value) || // Returns false on success.
531-
!(value == 0 ||
531+
!(value == 0 || value == ANSI_CTRL_UNDERLINE ||
532532
(value >= ANSI_FG_COLOR_BLACK && value <= ANSI_FG_COLOR_WHITE))) {
533533
llvm::errs() << "No valid color code in color escape sequence.\n";
534534
continue;
@@ -542,6 +542,8 @@ class Surface {
542542
wattr_set(m_window, saved_attr, saved_pair, nullptr);
543543
if (use_blue_background)
544544
::wattron(m_window, COLOR_PAIR(WhiteOnBlue));
545+
} else if (value == ANSI_CTRL_UNDERLINE) {
546+
::wattron(m_window, A_UNDERLINE);
545547
} else {
546548
// Mapped directly to first 16 color pairs (black/blue background).
547549
::wattron(m_window, COLOR_PAIR(value - ANSI_FG_COLOR_BLACK + 1 +
@@ -7013,7 +7015,12 @@ class SourceFileWindowDelegate : public WindowDelegate {
70137015
window.AttributeOn(highlight_attr);
70147016

70157017
StreamString lineStream;
7016-
m_file_sp->DisplaySourceLines(curr_line + 1, {}, 0, 0, &lineStream);
7018+
7019+
llvm::Optional<size_t> column;
7020+
if (is_pc_line && m_sc.line_entry.IsValid() && m_sc.line_entry.column)
7021+
column = m_sc.line_entry.column - 1;
7022+
m_file_sp->DisplaySourceLines(curr_line + 1, column, 0, 0,
7023+
&lineStream);
70177024
StringRef line = lineStream.GetString();
70187025
if (line.endswith("\n"))
70197026
line = line.drop_back();

0 commit comments

Comments
 (0)