[log-view] show search hits in the left file line with a reverse-video marker

If the search-hit is past the right side of the screen (as mentioned in #394)
we should try to make that more obvious by adding a highlight on the left.
This commit is contained in:
Timothy Stack 2016-12-10 07:35:08 -08:00
parent f567aafe3b
commit bc91a8e281

View File

@ -195,10 +195,8 @@ void logfile_sub_source::text_value_for_line(textview_curses &tc,
} }
} }
if (this->lss_files.size() > 1) { // Insert space for the file/search-hit markers.
// Insert space for the file markers.
value_out.insert(0, 1, ' '); value_out.insert(0, 1, ' ');
}
if (this->lss_flags & F_TIME_OFFSET) { if (this->lss_flags & F_TIME_OFFSET) {
int64_t start_millis, curr_millis; int64_t start_millis, curr_millis;
@ -295,7 +293,6 @@ void logfile_sub_source::text_attrs_for_line(textview_curses &lv,
this->lss_token_shift_size); this->lss_token_shift_size);
} }
if (this->lss_files.size() > 1) {
shift_string_attrs(value_out, 0, 1); shift_string_attrs(value_out, 0, 1);
lr.lr_start = 0; lr.lr_start = 0;
@ -321,10 +318,18 @@ void logfile_sub_source::text_attrs_for_line(textview_curses &lv,
} }
value_out.push_back( value_out.push_back(
string_attr(lr, &view_curses::VC_GRAPHIC, graph)); string_attr(lr, &view_curses::VC_GRAPHIC, graph));
bookmark_vector<vis_line_t> &bv_search = bm[&textview_curses::BM_SEARCH];
if (binary_search(::begin(bv_search), ::end(bv_search), vis_line_t(row))) {
lr.lr_start = 0;
lr.lr_end = 1;
value_out.push_back(string_attr(
lr, &view_curses::VC_STYLE, A_REVERSE));
}
} }
value_out.push_back(string_attr(lr, &view_curses::VC_STYLE, vc.attrs_for_ident( value_out.push_back(string_attr(lr, &view_curses::VC_STYLE, vc.attrs_for_ident(
this->lss_token_file->get_filename()))); this->lss_token_file->get_filename())));
}
if (this->lss_flags & F_TIME_OFFSET) { if (this->lss_flags & F_TIME_OFFSET) {
time_offset_end = 13; time_offset_end = 13;