Skip to content

Commit 2c59660

Browse files
committed
[format] tags defined in formats can capture
1 parent ebca259 commit 2c59660

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/logfile.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,10 +1800,12 @@ logfile::rebuild_index(std::optional<ui_clock::time_point> deadline)
18001800
break;
18011801
}
18021802
#endif
1803-
if (this->lf_format) {
1803+
if (this->lf_format && li.li_utf8_scan_result.is_valid()) {
18041804
auto sf = sbr.to_string_fragment();
18051805

18061806
for (const auto& td : this->lf_applicable_taggers) {
1807+
thread_local auto tag_md
1808+
= lnav::pcre2pp::match_data::unitialized();
18071809
auto curr_ll = this->end() - 1;
18081810

18091811
if (td->ftd_level != LEVEL_UNKNOWN
@@ -1812,11 +1814,11 @@ logfile::rebuild_index(std::optional<ui_clock::time_point> deadline)
18121814
continue;
18131815
}
18141816

1815-
if (td->ftd_pattern.pp_value
1816-
->find_in(sf, PCRE2_NO_UTF_CHECK)
1817-
.ignore_error()
1818-
.has_value())
1819-
{
1817+
auto match_res = td->ftd_pattern.pp_value->capture_from(sf)
1818+
.into(tag_md)
1819+
.matches(PCRE2_NO_UTF_CHECK)
1820+
.ignore_error();
1821+
if (match_res) {
18201822
while (curr_ll->is_continued()) {
18211823
--curr_ll;
18221824
}

0 commit comments

Comments
 (0)