annotate src/libvterm/find-wide-chars.pl @ 20443:e02d45e302a2 v8.2.0776

patch 8.2.0776: libvterm code lags behind the upstream version Commit: https://github.com/vim/vim/commit/e178ba36546ec7805020280910306331f1ef4ed0 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 17 14:59:47 2020 +0200 patch 8.2.0776: libvterm code lags behind the upstream version Problem: Libvterm code lags behind the upstream version. Solution: Include revision 719.
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 May 2020 15:00:04 +0200
parents
children 55a373a243c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20443
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 #!/usr/bin/perl
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 use strict;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 use warnings;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 use Unicode::UCD qw( charprop );
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 STDOUT->autoflush(1);
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 sub iswide
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 {
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 my ( $cp ) = @_;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 my $width = charprop( $cp, "East_Asian_Width" ) or return;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 return $width eq "Wide" || $width eq "Fullwidth";
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 }
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 my ( $start, $end );
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 foreach my $cp ( 0 .. 0x1FFFF ) {
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 iswide($cp) or next;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 if( defined $end and $end == $cp-1 ) {
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 # extend the range
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 $end = $cp;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 next;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 }
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 # start a new range
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 printf " { %#04x, %#04x },\n", $start, $end if defined $start;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 $start = $end = $cp;
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 }
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
e02d45e302a2 patch 8.2.0776: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 printf " { %#04x, %#04x },\n", $start, $end if defined $start;