klogg icon indicating copy to clipboard operation
klogg copied to clipboard

Highlight matches don't work in logical combining mode

Open xaljer opened this issue 4 years ago • 4 comments

Also no right on pattern like aaa.*(bbb|ccc), highlight matches only show bbb and ccc.

xaljer avatar Jul 31 '21 04:07 xaljer

That is known limitation of highlighters engine. It uses Qt regular expressions, and not the full Hyperscan+exprtk thing. The reason for this is that Hyperscan by default does not provide start of match offset, and does not provide matches capture groups.

As for expressions like aaa.*(bbb|ccc) -- there is a capture group there, so klogg assumes, that user wants to see only captured part highlighted. For regular highlighters that should be configurable, and for match highlights -- capture groups should be ingored.

variar avatar Jul 31 '21 05:07 variar

Moved capture group highlight issues to #373

variar avatar Jul 31 '21 08:07 variar

I thought this was the intended behavior, no? 👀

If you need to use capture groups but want to highlight the whole match, simply wrap the whole match in another capture group c: Like this: (aaa.*(bbb|ccc))

reflekteur avatar Aug 26 '21 01:08 reflekteur

The behaviour for capture groups is intended, but sometimes they are used just to group alternatives for | operation. Wrapping the whole expression with another set of parentheses is a clever trick, but an option to disable groups highlight (#373) can be more intuitive.

variar avatar Aug 26 '21 04:08 variar