[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Consider control characters to have a 0 width
From: |
Patrice Dumas |
Subject: |
branch master updated: Consider control characters to have a 0 width |
Date: |
Wed, 06 Sep 2023 02:47:48 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new a2a3ded7f3 Consider control characters to have a 0 width
a2a3ded7f3 is described below
commit a2a3ded7f3b33939815e6f1182d74d6167033d54
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 6 08:47:11 2023 +0200
Consider control characters to have a 0 width
* tp/Texinfo/Convert/Unicode.pm (string_width): do not consider space
control characters especially. This is better for line feed, carriage
return and form feed, and vertical or horizontal tabs should not
happen in situations where we want to know the width of strings.
---
ChangeLog | 9 ++++
tp/Texinfo/Convert/Unicode.pm | 7 +--
.../formats_encodings/at_commands_in_refs.pl | 56 ++++++++++-----------
.../at_commands_in_refs_latin1.pl | 2 +-
.../res_info/at_commands_in_refs_latin1.info | Bin 8005 -> 8004 bytes
.../formats_encodings/at_commands_in_refs_utf8.pl | 2 +-
.../res_info/at_commands_in_refs_utf8.info | Bin 8402 -> 8401 bytes
.../unclosed_verb_on_section_line.pl | 2 +-
.../moresectioning/only_special_spaces_node.pl | 22 ++++----
.../in_menu_only_special_ascii_spaces_node.pl | 8 +--
.../in_menu_only_special_ascii_spaces_node_menu.pl | 8 +--
.../sectioning/in_menu_only_special_spaces_node.pl | 22 ++++----
.../in_menu_only_special_spaces_node_menu.pl | 22 ++++----
13 files changed, 83 insertions(+), 77 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f0ce940546..91623d93ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-09-06 Patrice Dumas <pertusus@free.fr>
+
+ Consider control characters to have a 0 width
+
+ * tp/Texinfo/Convert/Unicode.pm (string_width): do not consider space
+ control characters especially. This is better for line feed, carriage
+ return and form feed, and vertical or horizontal tabs should not
+ happen in situations where we want to know the width of strings.
+
2023-09-05 Patrice Dumas <pertusus@free.fr>
Add customization of external node reference names
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index 43145e1020..a5a308d6a5 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -1666,7 +1666,7 @@ sub string_width($)
# Optimise for the common case where we can just return the length
# of the string. These regexes are faster than making the substitutions
# below.
- if ($string =~ /^[\p{IsPrint}\p{IsSpace}]*$/
+ if ($string =~ /^[\p{IsPrint}]*$/
and $string !~ /[\p{InFullwidth}\pM]/) {
return length($string);
}
@@ -1674,7 +1674,6 @@ sub string_width($)
$string =~ s/\p{InFullwidth}/\x{02}/g;
$string =~ s/\pM/\x{00}/g;
$string =~ s/\p{IsPrint}/\x{01}/g;
- $string =~ s/\p{IsSpace}/\x{01}/g;
$string =~ s/[^\x{01}\x{02}]/\x{00}/g;
# This sums up the byte values of the bytes in $string, which now are
@@ -1691,12 +1690,10 @@ sub string_width($)
$width += 2;
} elsif ($character =~ /\pM/) {
# a mark set at length 0
- } elsif ($character =~ /\p{IsPrint}/ or $character =~ /\p{IsSpace}/) {
- # newlines are not {IsPrint} in v5.14.2
+ } elsif ($character =~ /\p{IsPrint}/) {
$width += 1;
} elsif ($character =~ /\p{IsControl}/) {
# Control chars may be added, for instance, as part of @image formatting
- #} elsif ($character eq '') { # could that happen?
} else {
#print STDERR "unknown char`$character'\n";
}
diff --git a/tp/t/results/formats_encodings/at_commands_in_refs.pl
b/tp/t/results/formats_encodings/at_commands_in_refs.pl
index 763c2c8976..4e6932d721 100644
--- a/tp/t/results/formats_encodings/at_commands_in_refs.pl
+++ b/tp/t/results/formats_encodings/at_commands_in_refs.pl
@@ -14852,7 +14852,7 @@ $result_texts{'at_commands_in_refs'} = 'Top
2 !
. . ? @
-******************
+*****************
3 @ { } \\ #
***********
@@ -16648,7 +16648,7 @@ $result_converted{'plaintext'}->{'at_commands_in_refs'}
= 'Top
2 !
. . ? @
-***************
+**************
3 @ { } \\ #
***********
@@ -17827,7 +17827,7 @@ File: , Node: ! . . ? @, Next: @ { } \\ #, Prev:
{ }, Up: Top
2 !
. . ? @
-***************
+**************
File: , Node: @ { } \\ #, Next: LaTeX TeX • , © ... ..., Prev: ! . .
? @, Up: Top
@@ -18041,31 +18041,31 @@ Tag Table:
Node: Top27
Node: { }875
Node: ! . . ? @954
-Node: @ { } \\ #1059
-Node: LaTeX TeX • , © ... ...1181
-Node: ≡ error→ € ¡ ↦ −1348
-Node: ≥ ≤ →1511
-Node: ª º ⋆ £ ⊣ ¿ ®1641
-Node: ⇒ ° a b a sunny day å1788
-Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1976
-Node: ä ẽ î â à é ç ē e̊ e̋ ę2199
-Node: ė ĕ e̲ ẹ ě ȷ e͡e2411
-Node: ı Ḕ Ḉ2574
-Node: “ ” ‘ ’ „ ‚2702
-Node: « » « » ‹ ›2844
-Node: `` \'\' --- -- ` \'2988
-Node: AAA (fff) AAA BBB3120
-Node: CCC (rrr) CCC DDD3260
-Node: the someone <someone@somewher> <no_explain@there>3433
-Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image
description\\"\\"\\\\."