summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/lnav/files/lnav-0.9.0-bug792582.patch')
-rw-r--r--app-admin/lnav/files/lnav-0.9.0-bug792582.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/app-admin/lnav/files/lnav-0.9.0-bug792582.patch b/app-admin/lnav/files/lnav-0.9.0-bug792582.patch
new file mode 100644
index 000000000000..9059712242a6
--- /dev/null
+++ b/app-admin/lnav/files/lnav-0.9.0-bug792582.patch
@@ -0,0 +1,97 @@
+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>
+---
+ src/highlighter.cc | 4 +++-
+ src/logfile_sub_source.cc | 17 ++++++++++-------
+ src/view_curses.cc | 9 ++++++---
+ 3 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/src/highlighter.cc b/src/highlighter.cc
+index 24aafebd..110ca03f 100644
+--- 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);
+
+diff --git a/src/logfile_sub_source.cc b/src/logfile_sub_source.cc
+index 14e87002..dce0d4ae 100644
+--- 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;
+diff --git a/src/view_curses.cc b/src/view_curses.cc
+index 4a36a3ad..2456d53d 100644
+--- 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);
+
+--
+2.31.1
+