Skip Menu |

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

Report information
The Basics
Id: 98700
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.09
Fixed in: 0.10



Subject: Tag seems to have gone missing
eval: my $fmt = String::Tagged->new( "[%H:%M] " )->apply_tag( 1, 2, fg => "red" )->apply_tag( 4, 2, fg => "blue" ); (Cannot represent ref String::Tagged) eval: print $fmt->debug_sprintf [%H:%M] [] fg => red [] fg => blue eval: $fmt->get_tags_at( 0 ) { } eval: $fmt->get_tags_at( 1 ) { fg => 'red' } eval: $fmt->get_tags_at( 2 ) { fg => 'red' } eval: $fmt->get_tags_at( 3 ) { } eval: $fmt->get_tags_at( 4 ) { } eval: $fmt->get_tags_at( 5 ) { } eval: $fmt->get_tags_at( 6 ) { } eval: $fmt->get_tags_at( 7 ) { } Where'd blue go? -- Paul Evans
Turns out to be simple -- Paul Evans
Subject: rt98700.patch
=== modified file 'lib/String/Tagged.pm' --- lib/String/Tagged.pm 2014-09-04 15:15:21 +0000 +++ lib/String/Tagged.pm 2014-09-08 16:02:01 +0000 @@ -823,8 +823,8 @@ foreach my $t ( @$tags ) { my ( $ts, $te, $tn, $tv ) = @$t; - next if $pos < $ts; - last if $pos >= $te; + last if $ts > $pos; + next if $te <= $pos; $tags{$tn} = $tv; } === modified file 't/02tags-conststr.t' --- t/02tags-conststr.t 2013-03-15 21:42:53 +0000 +++ t/02tags-conststr.t 2014-09-08 16:02:01 +0000 @@ -185,6 +185,17 @@ ], 'tags list with edge-anchored tags' ); +# RT98700 +{ + my $str = String::Tagged->new( "Hello" ); + + $str->apply_tag( 1, 1, one => 1 ); + $str->apply_tag( 4, 1, four => 4 ); + + is_deeply( $str->get_tags_at( 1 ), { one => 1 }, '->get_tags_at( 1 )' ); + is_deeply( $str->get_tags_at( 4 ), { four => 4 }, '->get_tags_at( 4 )' ); +} + my $str2 = String::Tagged->new( $str ); is( $str2->str, "BEGIN middle END", 'constructor clones string' );
Released in 0.10 -- Paul Evans