Skip Menu |

This queue is for tickets about the String-Tagged CPAN distribution.

Report information
The Basics
Id: 120691
Status: resolved
Priority: 0/
Queue: String-Tagged

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.13
Fixed in: 0.14



Subject: ->get_tag_extent gives up too soon
Given a tag with two disjoint tags in, ->get_tag_extent can't see the second tag. my $str = String::Tagged->new; $str->append_tagged( "first", first => 1 ); $str->append_tagged( "second", second => 1 ); my $e = $str->get_tag_extent( 8, "second" ); ok( $e, 'second tag defined' ); -- Paul Evans
Fixed. -- Paul Evans
Subject: rt120691.patch
=== modified file 'lib/String/Tagged.pm' --- lib/String/Tagged.pm 2017-03-16 18:00:27 +0000 +++ lib/String/Tagged.pm 2017-03-22 18:25:15 +0000 @@ -1081,8 +1081,8 @@ foreach my $t ( @$tags ) { my ( $ts, $te, $tn, undef, $tf ) = @$t; - next if $pos < $ts; - last if $pos >= $te; + last if $ts > $pos; + next if $te <= $pos; next unless $tn eq $name; === modified file 't/07tags-range.t' --- t/07tags-range.t 2014-09-08 16:36:28 +0000 +++ t/07tags-range.t 2017-03-22 18:25:15 +0000 @@ -56,4 +56,17 @@ is( $e->start, 8, '$e->start' ); is( $e->end, 14, '$e->end' ); +# RT120691 +{ + my $str = String::Tagged->new; + $str->append_tagged( "first", first => 1 ); + $str->append_tagged( "second", second => 1 ); + + my $e = $str->get_tag_extent( 8, "second" ); + ok( $e, 'second tag defined' ) and do { + is( $e->start, 5, 'second tag start' ); + is( $e->length, 6, 'second tag length '); + }; +} + done_testing;
Released in 0.14 -- Paul Evans