[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Unicode.pm (string_width): u
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/Unicode.pm (string_width): use DefaultIgnorableCodePoint for better compatibility with old perls. |
Date: |
Thu, 07 Sep 2023 17:44:07 -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 fb84089486 * tp/Texinfo/Convert/Unicode.pm (string_width): use
DefaultIgnorableCodePoint for better compatibility with old perls.
fb84089486 is described below
commit fb840894869ce6d1a1d3ee3c90d2a7b4868d5264
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Sep 7 23:43:41 2023 +0200
* tp/Texinfo/Convert/Unicode.pm (string_width): use
DefaultIgnorableCodePoint for better compatibility with old perls.
---
ChangeLog | 5 +++++
tp/Texinfo/Convert/Unicode.pm | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d85e44030f..cac40be18c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-09-07 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Unicode.pm (string_width): use
+ DefaultIgnorableCodePoint for better compatibility with old perls.
+
2023-09-07 Gavin Smith <gavinsmith0123@gmail.com>
* README-hacking: add note re *.pot versions.
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index b7dcc86cfd..c2b1355b4a 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -1666,14 +1666,17 @@ 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.
+ # DefaultIgnorableCodePoint is documented in perl 5.10.1. In 2023 perl,
+ # it is Default_Ignorable_Code_Point, but DefaultIgnorableCodePoint
+ # seems to work too.
if ($string =~ /^[\p{IsPrint}]*$/
- and $string !~ /[\p{InFullwidth}\pM\p{Default_Ignorable_Code_Point}]/) {
+ and $string !~ /[\p{InFullwidth}\pM\p{DefaultIgnorableCodePoint}]/) {
return length($string);
}
$string =~ s/\p{InFullwidth}/\x{02}/g;
$string =~ s/\pM/\x{00}/g;
- $string =~ s/\p{Default_Ignorable_Code_Point}/\x{00}/g;
+ $string =~ s/\p{DefaultIgnorableCodePoint}/\x{00}/g;
$string =~ s/\p{IsPrint}/\x{01}/g;
$string =~ s/[^\x{01}\x{02}]/\x{00}/g;
@@ -1689,7 +1692,7 @@ sub string_width($)
foreach my $character(split '', $string) {
if ($character =~ /\p{InFullwidth}/) {
$width += 2;
- } elsif ($character =~ /[\pM\p{Default_Ignorable_Code_Point}]/) {
+ } elsif ($character =~ /[\pM\p{DefaultIgnorableCodePoint}]/) {
# a mark set at length 0 or a Default Ignorable Code Point
# that have no visible glyph or advance width in and of themselves
} elsif ($character =~ /\p{IsPrint}/) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Unicode.pm (string_width): use DefaultIgnorableCodePoint for better compatibility with old perls.,
Patrice Dumas <=