Skip to content

Commit

Permalink
Fix issue with highlighting
Browse files Browse the repository at this point in the history
Found when adding tests
  • Loading branch information
lizmat committed Aug 17, 2024
1 parent 1dc2600 commit 67114b3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Revision history for App-Rak

{{$NEXT}}
- Fix issue with highlighting if :smartmark or :smartcase
were specified, and the needle didn't match exactly
- Up dependency on "highlighter" to get proper :smartcase
and :smartmark support

0.3.4 2024-08-16T20:30:55+02:00
- Complete migration to Needle::Compile, which introduces a
Expand Down
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"as-cli-arguments:ver<0.0.8>:auth<zef:lizmat>",
"Backtrace::Files:ver<0.0.4>:auth<zef:lizmat>",
"CLI::Version:ver<0.0.9>:auth<zef:lizmat>",
"highlighter:ver<0.0.20>:auth<zef:lizmat>",
"highlighter:ver<0.0.21>:auth<zef:lizmat>",
"IO::Path::AutoDecompress:ver<0.0.3>:auth<zef:lizmat>",
"JSON::Fast::Hyper:ver<0.0.7>:auth<zef:lizmat>",
"META::constants:ver<0.0.4>:auth<zef:lizmat>",
Expand Down
12 changes: 8 additions & 4 deletions lib/App/Rak.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use rak:ver<0.0.59>:auth<zef:lizmat>; # rak Rak
use Backtrace::Files:ver<0.0.4>:auth<zef:lizmat> <
backtrace-files
>;
use highlighter:ver<0.0.20>:auth<zef:lizmat> <
columns highlighter matches
use highlighter:ver<0.0.21>:auth<zef:lizmat> <
columns highlighter
>;
use Needle::Compile:ver<0.0.7>:auth<zef:lizmat> <
compile-needle implicit2explicit StrType Type
Expand Down Expand Up @@ -798,7 +798,9 @@ my sub show-results(--> Nil) {
my &line-post-proc := do if $highlight && @highlights {
my %nameds =
(:$smartcase if $smartcase),
(:$ignorecase if $ignorecase),
(:$smartmark if $smartmark),
(:$ignoremark if $ignoremark),
(:summary-if-larger-than($_)
with %listing<summary-if-larger-than>:delete),
Expand Down Expand Up @@ -2712,7 +2714,8 @@ my sub action-edit(--> Nil) {
@files.append: @matches.map: {
$path => .key => (columns(
.value, $target,
:$ignorecase, :$ignoremark, |(:$type if $type)
:$ignorecase, :$smartcase, :$ignoremark, :$smartmark,
|(:$type if $type)
).head // 0)
}
}
Expand Down Expand Up @@ -3495,7 +3498,8 @@ my sub action-vimgrep(--> Nil) {
~ ':' ~ .key
~ ':' ~ (columns(
.value, $target,
:$ignorecase, :$ignoremark, |(:$type if $type)
:$ignorecase, :$smartcase, :$ignoremark, :$smartmark,
|(:$type if $type)
).head // "0")
~ ':' ~ .value
for @matches;
Expand Down
51 changes: 51 additions & 0 deletions xt/01-simple.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,57 @@ nine
10:{BON}nine{BOFF}
OK

query-ok <v --and=n>, :head(2), ok => qq:to/OK/;
seven
8:se{BON}v{BOFF}e{BON}n{BOFF}

eight
8:se{BON}v{BOFF}e{BON}n{BOFF}

nine
8:se{BON}v{BOFF}e{BON}n{BOFF}
OK

query-ok <v --or=x --smartcase>, :head(2), ok => qq:to/OK/;
five
6:fi{BON}v{BOFF}e

six
6:fi{BON}v{BOFF}e
7:SI{BON}X{BOFF}

seven
6:fi{BON}v{BOFF}e
7:SI{BON}X{BOFF}
8:se{BON}v{BOFF}en

eight
6:fi{BON}v{BOFF}e
7:SI{BON}X{BOFF}
8:se{BON}v{BOFF}en

nine
6:fi{BON}v{BOFF}e
7:SI{BON}X{BOFF}
8:se{BON}v{BOFF}en
OK

=finish

query-ok <--not=e --andnot=o --andnot=^$>, :head(2), ok => qq:to/OK/;
six
7:SIX

seven
7:SIX

eight
7:SIX

nine
7:SIX
OK

done-testing;

# vim: expandtab shiftwidth=4

0 comments on commit 67114b3

Please sign in to comment.