|  |  | @ -1,28 +1,21 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package Tk::BrowseEdit; |  |  |  | package Tk::BrowseEdit; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | use Tk; |  |  |  | use Tk; | 
			
		
	
		
		
			
				
					
					|  |  |  | use Tk::Font; |  |  |  | use Tk::Font; | 
			
		
	
		
		
			
				
					
					|  |  |  | use base 'Tk::Frame'; |  |  |  | use base 'Tk::Frame'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | use strict; |  |  |  | use strict; | 
			
		
	
		
		
			
				
					
					|  |  |  | use warnings; |  |  |  | use warnings; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | Construct Tk::Widget 'BrowseEdit'; |  |  |  | Construct Tk::Widget 'BrowseEdit'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sub ClassInit |  |  |  | sub ClassInit | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($class, $mw) = @_; |  |  |  |         my ($class, $mw) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  |         $class->SUPER::ClassInit($mw); |  |  |  |         $class->SUPER::ClassInit($mw); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sub Populate |  |  |  | sub Populate | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($self, $args) = @_; |  |  |  |         my ($self, $args) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->SUPER::Populate($args); |  |  |  |         $self->SUPER::Populate($args); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->{panel} = $self->Frame(-borderwidth => 0)->pack(-fill => 'both'); |  |  |  |         $self->{panel} = $self->Frame(-borderwidth => 0)->pack(-fill => 'both'); | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->{text} = $self->Text->pack(-expand => 1, -fill => 'both'); |  |  |  |         $self->{text} = $self->Text->pack(-expand => 1, -fill => 'both'); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->{'<b>'} = $self->{panel}->Button(-text => 'B', -relief => 'flat', |  |  |  |         $self->{'<b>'} = $self->{panel}->Button(-text => 'B', -relief => 'flat', | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -font => $self->Font(-family => 'times', -weight => 'bold', -size => '8'), |  |  |  |                 -font => $self->Font(-family => 'times', -weight => 'bold', -size => '8'), | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -command => [sub { |  |  |  |                 -command => [sub { | 
			
		
	
	
		
		
			
				
					|  |  | @ -30,9 +23,8 @@ sub Populate | 
			
		
	
		
		
			
				
					
					|  |  |  |                         $self->toggleTag('<b>'); |  |  |  |                         $self->toggleTag('<b>'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 }, $self] |  |  |  |                 }, $self] | 
			
		
	
		
		
			
				
					
					|  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); |  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	$self->{text}->tagConfigure('<b>', -font => $self->Font(-family => 'times', -weight => 'bold')); |  |  |  |         $self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	$self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, $self]); |  |  |  | $self]); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         $self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', |  |  |  |         $self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), |  |  |  |                 -font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -command => [sub { |  |  |  |                 -command => [sub { | 
			
		
	
	
		
		
			
				
					|  |  | @ -40,9 +32,7 @@ sub Populate | 
			
		
	
		
		
			
				
					
					|  |  |  |                         $self->toggleTag('<i>'); |  |  |  |                         $self->toggleTag('<i>'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 }, $self] |  |  |  |                 }, $self] | 
			
		
	
		
		
			
				
					
					|  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); |  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	$self->{text}->tagConfigure('<i>', -font => $self->Font(-family => 'times', -slant => 'italic')); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); |  |  |  |         $self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', |  |  |  |         $self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -font => $self->Font(-family => 'times', -underline => 1, -size => '8'), |  |  |  |                 -font => $self->Font(-family => 'times', -underline => 1, -size => '8'), | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -command => [sub { |  |  |  |                 -command => [sub { | 
			
		
	
	
		
		
			
				
					|  |  | @ -50,43 +40,50 @@ sub Populate | 
			
		
	
		
		
			
				
					
					|  |  |  |                         $self->toggleTag('<u>'); |  |  |  |                         $self->toggleTag('<u>'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 }, $self] |  |  |  |                 }, $self] | 
			
		
	
		
		
			
				
					
					|  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); |  |  |  |                 )->pack(-pady => 0, -side => 'left', -fill => 'both'); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	$self->{text}->tagConfigure('<u>', -font => $self->Font(-family => 'times', -underline => 1)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |          |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	$self->{text}->tagConfigure('elide', -elide => 1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |  |  |  |         $self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |         $self->{text}->tagConfigure('elide', -elide => 1); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         $self->ConfigSpecs( |  |  |  |         $self->ConfigSpecs( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 'DEFAULT' => [$self->{text}], |  |  |  |                 'DEFAULT' => [$self->{text}], | 
			
		
	
		
		
			
				
					
					|  |  |  |                 -background => [$self] |  |  |  |                 -background => [$self] | 
			
		
	
		
		
			
				
					
					|  |  |  |         ); |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->Delegates( |  |  |  |         $self->Delegates( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 'DEFAULT' => $self->{text}, |  |  |  |                 'DEFAULT' => $self->{text}, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 'to_html' => $self, |  |  |  |                 'to_html' => $self, | 
			
		
	
		
		
			
				
					
					|  |  |  |         ); |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $self->after(200, [$self, "init"]); |  |  |  |         $self->after(200, [$self, "init"]); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sub toggleTag |  |  |  | sub toggleTag | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($self, $tag) = @_; |  |  |  |         my ($self, $tag) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(!defined($self->{text}->tagRanges('sel'))) |  |  |  |         if(!defined($self->{text}->tagRanges('sel'))) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if(!$self->{tags}->{$tag}) |  |  |  |                 # no selection - modify current position | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 	        print "starting\n"; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{text}->insert('insert', '%ignore%', [$tag, 'elide']); |  |  |  |                 my $cur_tag = ($self->{text}->tagNames('insert'))[0] || ""; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{text}->tagAdd($tag, 'insert'); |  |  |  | 		print "tag names gotten\n"; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{tags}->{$tag} = 1; |  |  |  |                 if ($cur_tag =~ /$tag/i) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{$tag}->configure(-relief => 'groove'); |  |  |  |                 { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         # tag is defined for this range - remove it from the composite tag name and then add the resulting | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         # tag, creating it if necessary | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         return unless $cur_tag ne ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->{text}->tagRemove($cur_tag, 'insert'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $cur_tag =~ s/$tag//i; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			print "creating tag\n"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->create_tag($cur_tag); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			print "tag created\n"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->tagAdd($cur_tag, 'insert'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->{$tag}->configure(-relief => 'flat'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 else |  |  |  |                 else | 
			
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{text}->insert('insert', '%ignore%', ['elide']); |  |  |  |                         # tag not enabled for this range - add it | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{text}->tagRemove($tag, 'insert'); |  |  |  |                         $self->{text}->tagRemove($cur_tag, 'insert'); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{tags}->{$tag} = 0; |  |  |  |                         $cur_tag .= $tag; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			$self->{$tag}->configure(-relief => 'flat'); |  |  |  |                         $self->create_tag($cur_tag); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->tagAdd($cur_tag, 'insert'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         $self->{$tag}->configure(-relief => 'sunken'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         else |  |  |  |         else | 
			
		
	
	
		
		
			
				
					|  |  | @ -94,13 +91,11 @@ sub toggleTag | 
			
		
	
		
		
			
				
					
					|  |  |  |                 my ($selstart, $selend) = $self->{text}->tagRanges('sel'); |  |  |  |                 my ($selstart, $selend) = $self->{text}->tagRanges('sel'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 my @tags = $self->{text}->tagRanges($tag); |  |  |  |                 my @tags = $self->{text}->tagRanges($tag); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 my (@starts, @ends); |  |  |  |                 my (@starts, @ends); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for(my $i = 0; $i < @tags; $i += 2) |  |  |  |                 for(my $i = 0; $i < @tags; $i += 2) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         push @starts, $tags[$i]; |  |  |  |                         push @starts, $tags[$i]; | 
			
		
	
		
		
			
				
					
					|  |  |  |                         push @ends, $tags[$i + 1]; |  |  |  |                         push @ends, $tags[$i + 1]; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for my $start (@starts) |  |  |  |                 for my $start (@starts) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         for my $end (@ends) |  |  |  |                         for my $end (@ends) | 
			
		
	
	
		
		
			
				
					|  |  | @ -108,77 +103,79 @@ sub toggleTag | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 if($selstart >= $start and $selend <= $end) |  |  |  |                                 if($selstart >= $start and $selend <= $end) | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 { |  |  |  |                                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                         $self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); |  |  |  |                                         $self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				$self->{$tag}->configure(-relief => 'raised'); |  |  |  |                                         $self->{$tag}->configure(-relief => 'flat'); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                         return; |  |  |  |                                         return; | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 } |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); |  |  |  |                 $self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $self->{$tag}->configure(-relief => 'sunken'); |  |  |  |                 $self->{$tag}->configure(-relief => 'sunken'); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | sub create_tag | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         my ($self, $tag) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return if $self->{created_tags}->{$tag}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         my (%tagparams, %fontparams); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if($tag =~ /<u>/) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 $fontparams{-underline} = 1; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if($tag =~ /<b>/) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 $fontparams{-weight} = 'bold'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if($tag =~ /<i>/) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 $fontparams{-slant} = 'italic'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         $self->tagConfigure($tag, %tagparams, -font => $self->Font(%fontparams)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | sub to_html |  |  |  | sub to_html | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($self, $start, $end) = @_; |  |  |  |         my ($self, $start, $end) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         $start ||= '0.0'; |  |  |  |         $start ||= '0.0'; | 
			
		
	
		
		
			
				
					
					|  |  |  |         $end ||= 'end'; |  |  |  |         $end ||= 'end'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         my @tags = $self->{text}->tagNames; |  |  |  |         my @tags = $self->{text}->tagNames; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         my $res; |  |  |  |         my $res; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         my $pos = '1.0'; |  |  |  |         my $pos = '1.0'; | 
			
		
	
		
		
			
				
					
					|  |  |  |         my $chars; |  |  |  |         my $chars; | 
			
		
	
		
		
			
				
					
					|  |  |  |         my %curtags; |  |  |  |         my %curtags; | 
			
		
	
		
		
			
				
					
					|  |  |  |         my %chartags; |  |  |  |         my %chartags; | 
			
		
	
		
		
			
				
					
					|  |  |  |         my (@addtags, @deltags); |  |  |  |         my (@addtags, @deltags); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         while($self->{text}->index($pos) != $self->{text}->index('end')) |  |  |  |         while($self->{text}->index($pos) != $self->{text}->index('end')) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 %chartags = (); |  |  |  |                 %chartags = (); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $chartags{$_} = 1 for $self->{text}->tagNames($pos); |  |  |  |                 $chartags{$_} = 1 for $self->{text}->tagNames($pos); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 delete $chartags{'elide'}; |  |  |  |                 delete $chartags{'elide'}; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 delete $chartags{'sel'}; |  |  |  |                 delete $chartags{'sel'}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (keys %chartags) |  |  |  |                 for (keys %chartags) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         push @addtags, $_ unless $curtags{$_} |  |  |  |                         push @addtags, $_ unless $curtags{$_} | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (keys %curtags) |  |  |  |                 for (keys %curtags) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         push @deltags, $_ if !$chartags{$_}; |  |  |  |                         push @deltags, $_ if !$chartags{$_}; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 %curtags = (); |  |  |  |                 %curtags = (); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $curtags{$_} = 1 for keys %chartags; |  |  |  |                 $curtags{$_} = 1 for keys %chartags; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $res .= $_ for @addtags; |  |  |  |                 $res .= $_ for @addtags; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $res .= end_tag($_) for @deltags; |  |  |  |                 $res .= end_tag($_) for @deltags; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 @deltags = @addtags = (); |  |  |  |                 @deltags = @addtags = (); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $res .= $self->{text}->get($pos); |  |  |  |                 $res .= $self->{text}->get($pos); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |  |  |  |                 $pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |         $res =~ s/\%*ignore\%*//g; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return $res; |  |  |  |         return $res; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sub end_tag |  |  |  | sub end_tag | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($tag) = @_; |  |  |  |         my ($tag) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  |         $tag =~ s/^</<\//; |  |  |  |         $tag =~ s/^</<\//; | 
			
		
	
		
		
			
				
					
					|  |  |  |         return $tag; |  |  |  |         return $tag; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sub init |  |  |  | sub init | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |         my ($self) = @_; |  |  |  |         my ($self) = @_; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 1; |  |  |  | 1; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |