You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
3.1 KiB
83 lines
3.1 KiB
From 141436933a8d30edfd33aa5fcfb0c93cfa3ae9d5 Mon Sep 17 00:00:00 2001
|
|
From: Timothy Stack <timothyshanestack@gmail.com>
|
|
Date: Wed, 9 Dec 2020 15:35:06 -0800
|
|
Subject: [PATCH] [view_curses] use VC_ROLE instead of VC_STYLE where possible
|
|
and fix segv in mvwattrline
|
|
|
|
Fixes #806
|
|
|
|
Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
|
|
--- a/src/highlighter.cc
|
|
+++ b/src/highlighter.cc
|
|
@@ -115,7 +115,9 @@ void highlighter::annotate(attr_line_t &al, int start) const
|
|
vc.match_color(this->h_bg));
|
|
}
|
|
if (this->h_role != view_colors::VCR_NONE) {
|
|
- attrs |= vc.attrs_for_role(this->h_role);
|
|
+ sa.emplace_back(lr,
|
|
+ &view_curses::VC_ROLE,
|
|
+ this->h_role);
|
|
}
|
|
sa.emplace_back(lr, &view_curses::VC_STYLE, attrs);
|
|
|
|
--- a/src/logfile_sub_source.cc
|
|
+++ b/src/logfile_sub_source.cc
|
|
@@ -468,25 +468,28 @@ void logfile_sub_source::text_attrs_for_line(textview_curses &lv,
|
|
|
|
shift_string_attrs(value_out, 0, time_offset_end);
|
|
|
|
- attrs = vc.attrs_for_role(view_colors::VCR_OFFSET_TIME);
|
|
- value_out.emplace_back(lr, &view_curses::VC_STYLE, attrs);
|
|
+ value_out.emplace_back(lr,
|
|
+ &view_curses::VC_ROLE,
|
|
+ view_colors::VCR_OFFSET_TIME);
|
|
value_out.emplace_back(line_range(12, 13),
|
|
&view_curses::VC_GRAPHIC, ACS_VLINE);
|
|
|
|
- int bar_attrs = 0;
|
|
+ view_colors::role_t bar_role = view_colors::VCR_NONE;
|
|
|
|
switch (this->get_line_accel_direction(vis_line_t(row))) {
|
|
case log_accel::A_STEADY:
|
|
break;
|
|
case log_accel::A_DECEL:
|
|
- bar_attrs = vc.attrs_for_role(view_colors::VCR_DIFF_DELETE);
|
|
+ bar_role = view_colors::VCR_DIFF_DELETE;
|
|
break;
|
|
case log_accel::A_ACCEL:
|
|
- bar_attrs = vc.attrs_for_role(view_colors::VCR_DIFF_ADD);
|
|
+ bar_role = view_colors::VCR_DIFF_ADD;
|
|
break;
|
|
}
|
|
- value_out.push_back(
|
|
- string_attr(line_range(12, 13), &view_curses::VC_STYLE, bar_attrs));
|
|
+ if (bar_role != view_colors::VCR_NONE) {
|
|
+ value_out.emplace_back(
|
|
+ line_range(12, 13), &view_curses::VC_ROLE, bar_role);
|
|
+ }
|
|
}
|
|
|
|
lr.lr_start = 0;
|
|
--- a/src/view_curses.cc
|
|
+++ b/src/view_curses.cc
|
|
@@ -402,13 +402,16 @@ void view_curses::mvwattrline(WINDOW *window,
|
|
}
|
|
}
|
|
|
|
+ if (attr_range.lr_end == -1) {
|
|
+ attr_range.lr_end = line_width_chars;
|
|
+ }
|
|
+ if (attr_range.lr_end < lr_chars.lr_start) {
|
|
+ continue;
|
|
+ }
|
|
attr_range.lr_start = max(0, attr_range.lr_start - lr_chars.lr_start);
|
|
if (attr_range.lr_start > line_width_chars) {
|
|
continue;
|
|
}
|
|
- if (attr_range.lr_end == -1) {
|
|
- attr_range.lr_end = lr_chars.lr_start + line_width_chars;
|
|
- }
|
|
|
|
attr_range.lr_end = min(line_width_chars, attr_range.lr_end - lr_chars.lr_start);
|
|
|