=== 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;