mirror of
https://github.com/tstack/lnav
synced 2024-11-03 23:15:38 +00:00
[meta] highlight comments/tags in searches
This commit is contained in:
parent
a1de8f1fc1
commit
d020168860
@ -443,6 +443,7 @@ field_overlay_source::build_meta_line(const listview_curses& lv,
|
||||
if (iter != bm.end()) {
|
||||
const bookmark_metadata& line_meta = iter->second;
|
||||
size_t filename_width = this->fos_lss.get_filename_offset();
|
||||
auto* tc = dynamic_cast<const textview_curses*>(&lv);
|
||||
|
||||
if (!line_meta.bm_comment.empty()) {
|
||||
const auto* lead = line_meta.bm_tags.empty() ? " \u2514 "
|
||||
@ -452,6 +453,15 @@ field_overlay_source::build_meta_line(const listview_curses& lv,
|
||||
al.with_string(lead).append(
|
||||
lnav::roles::comment(line_meta.bm_comment));
|
||||
al.insert(0, filename_width, ' ');
|
||||
if (tc != nullptr) {
|
||||
auto hl = tc->get_highlights();
|
||||
auto hl_iter = hl.find({highlight_source_t::PREVIEW, "search"});
|
||||
|
||||
if (hl_iter != hl.end()) {
|
||||
hl_iter->second.annotate(al, filename_width);
|
||||
}
|
||||
}
|
||||
|
||||
dst.emplace_back(al);
|
||||
}
|
||||
if (!line_meta.bm_tags.empty()) {
|
||||
@ -473,6 +483,14 @@ field_overlay_source::build_meta_line(const listview_curses& lv,
|
||||
}
|
||||
}
|
||||
al.insert(0, filename_width, ' ');
|
||||
if (tc != nullptr) {
|
||||
auto hl = tc->get_highlights();
|
||||
auto hl_iter = hl.find({highlight_source_t::PREVIEW, "search"});
|
||||
|
||||
if (hl_iter != hl.end()) {
|
||||
hl_iter->second.annotate(al, filename_width);
|
||||
}
|
||||
}
|
||||
dst.emplace_back(al);
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
||||
└ #foo
|
||||
└ #[7mfoo[0m
|
||||
|
Loading…
Reference in New Issue
Block a user