diff --git a/src/core/Match.pm b/src/core/Match.pm index dd84e60cabb..dc359533b14 100644 --- a/src/core/Match.pm +++ b/src/core/Match.pm @@ -162,6 +162,12 @@ my class Match is Capture is Cool does NQPMatchRole { ) } +#?if js + my sub move_cursor($target, $pos) { + nqp::chars(nqp::substrnfg(nqp::substr($target, $pos), 0, 1)) || 1; + } +#?endif + method CURSOR_OVERLAP() { # adapted from !cursor_more in nqp nqp::stmts( (my $new := nqp::create(self)), @@ -183,7 +189,12 @@ my class Match is Capture is Cool does NQPMatchRole { nqp::bindattr_i($new,$?CLASS,'$!pos', nqp::if( nqp::isge_i($!from,$!pos), +#?if !js nqp::add_i($!from,1), +#?endif +#?if js + nqp::add_i($!from, move_cursor(self.target, $!pos)), +#?endif $!pos ) ),