view 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
line wrap: on
line source

#!/usr/bin/perl

use strict;
use warnings;

use Unicode::UCD qw( charprop );

STDOUT->autoflush(1);

sub iswide
{
   my ( $cp ) = @_;

   my $width = charprop( $cp, "East_Asian_Width" ) or return;
   return $width eq "Wide" || $width eq "Fullwidth";
}

my ( $start, $end );
foreach my $cp ( 0 .. 0x1FFFF ) {
   iswide($cp) or next;

   if( defined $end and $end == $cp-1 ) {
      # extend the range
      $end = $cp;
      next;
   }

   # start a new range
   printf "  { %#04x, %#04x },\n", $start, $end if defined $start;

   $start = $end = $cp;
}

printf "  { %#04x, %#04x },\n", $start, $end if defined $start;