texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6222] call to string_width in _printindex_formatted


From: Gavin D. Smith
Subject: [6222] call to string_width in _printindex_formatted
Date: Tue, 14 Apr 2015 16:21:06 +0000

Revision: 6222
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6222
Author:   gavin
Date:     2015-04-14 16:21:04 +0000 (Tue, 14 Apr 2015)
Log Message:
-----------
call to string_width in _printindex_formatted

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/Plaintext.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-04-13 16:55:18 UTC (rev 6221)
+++ trunk/ChangeLog     2015-04-14 16:21:04 UTC (rev 6222)
@@ -1,3 +1,9 @@
+2015-04-14  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Plaintext.pm (_printindex_formatted): Don't call 
+       Texinfo::Convert::Unicode::string_width with the part of the 
+       string we have already called it on.
+
 2015-04-13  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Common.pm (count_bytes): Add special handling of 

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2015-04-13 16:55:18 UTC (rev 
6221)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2015-04-14 16:21:04 UTC (rev 
6222)
@@ -1296,9 +1296,10 @@
     #$self->_add_text_count($entry_line);
     
     my $line_width = Texinfo::Convert::Unicode::string_width($entry_line);
+    my $entry_line_addition = '';
     if ($line_width < $index_length_to_node) {
       my $spaces = ' ' x ($index_length_to_node - $line_width);
-      $entry_line .= $spaces;
+      $entry_line_addition .= $spaces;
       $self->_add_text_count($spaces);
     }
     my $node = $entry_nodes{$entry};
@@ -1315,7 +1316,7 @@
         $self->{'outside_of_any_node_text'}->{'count'} 
           = $end_context->{'bytes'};
       }
-      $entry_line .= $self->{'outside_of_any_node_text'}->{'text'};
+      $entry_line_addition .= $self->{'outside_of_any_node_text'}->{'text'};
       $self->{'count_context'}->[-1]->{'bytes'} 
             += $self->{'outside_of_any_node_text'}->{'count'};
       # FIXME when outside of sectioning commands this message was already
@@ -1328,18 +1329,19 @@
       }
     } else {
       my ($node_line, $byte_count) = $self->_node_line($node);
-      $entry_line .= $node_line;
+      $entry_line_addition .= $node_line;
       $self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
     }
-    $entry_line .= '.';
+    $entry_line_addition .= '.';
     $self->_add_text_count('.');
 
+    $entry_line .= $entry_line_addition;
     $result .= $entry_line;
 
     my $line_nr = $line_nrs{$entry};
     my $line_nr_spaces = sprintf("%${max_index_line_nr_string_length}d", 
$line_nr);
     my $line_part = "(line ${line_nr_spaces})";
-    $line_width = Texinfo::Convert::Unicode::string_width($entry_line);
+    $line_width += 
Texinfo::Convert::Unicode::string_width($entry_line_addition);
     my $line_part_width = Texinfo::Convert::Unicode::string_width($line_part);
     if ($line_width + $line_part_width +1 > $self->{'fillcolumn'}) {
       $line_part = "\n" . ' ' x ($self->{'fillcolumn'} - $line_part_width) 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]