]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostics: handle SGR codes in line_label::m_display_width
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 May 2024 01:22:51 +0000 (21:22 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 May 2024 01:22:51 +0000 (21:22 -0400)
commita7be993806a90a58397e9d5bc9b54160ac9f35db
tree092dd8b667c8757aac3cd7455a3df02d4e7759ec
parent38dd4e26e07c6be7cf4d169141ee4f3a03f3a09d
diagnostics: handle SGR codes in line_label::m_display_width

gcc/ChangeLog:
* diagnostic-show-locus.cc: Define INCLUDE_VECTOR and include
"text-art/types.h".
(line_label::line_label): Drop "policy" argument.  Use
styled_string::calc_canvas_width when computing m_display_width,
as this skips SGR codes.
(layout::print_any_labels): Update for line_label ctor change.
(selftest::test_one_liner_labels_utf8): Update expected text to
reflect that the labels can fit on one line if we don't get
confused by SGR colorization codes.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic-show-locus.cc