diff -Nru libtickit-0.3.4/CHANGES libtickit-0.3.5/CHANGES --- libtickit-0.3.4/CHANGES 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/CHANGES 2020-03-02 19:11:02.000000000 +0000 @@ -1,3 +1,7 @@ +2020-03-02 19:09 0.3.5 + * Copied wcwidth() implementation from libvterm, for improved handling of + emoji characters and other fullwidth or wide characters (LP1865502) + 2020-01-27 00:25 0.3.4 * Added macros and functions for version query * Ensure that all kinds of event watches can be cancelled, even lone ones diff -Nru libtickit-0.3.4/debian/changelog libtickit-0.3.5/debian/changelog --- libtickit-0.3.4/debian/changelog 2020-02-02 17:59:25.000000000 +0000 +++ libtickit-0.3.5/debian/changelog 2020-03-18 01:08:02.000000000 +0000 @@ -1,3 +1,10 @@ +libtickit (0.3.5-1) unstable; urgency=medium + + * Update to new upstream version 0.3.5. + * Build-Depend on debhelper-compat (= 12) + + -- James McCoy Tue, 17 Mar 2020 21:08:02 -0400 + libtickit (0.3.4-1) unstable; urgency=medium * New upstream release diff -Nru libtickit-0.3.4/debian/compat libtickit-0.3.5/debian/compat --- libtickit-0.3.4/debian/compat 2020-02-02 17:59:25.000000000 +0000 +++ libtickit-0.3.5/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru libtickit-0.3.4/debian/control libtickit-0.3.5/debian/control --- libtickit-0.3.4/debian/control 2020-02-02 17:59:25.000000000 +0000 +++ libtickit-0.3.5/debian/control 2020-03-18 01:08:02.000000000 +0000 @@ -2,7 +2,7 @@ Priority: optional Maintainer: James McCoy Build-Depends: - debhelper (>= 11), + debhelper-compat (= 12), libtermkey-dev, libtool-bin, libunibilium-dev (>= 1.1.0), diff -Nru libtickit-0.3.4/include/tickit.h libtickit-0.3.5/include/tickit.h --- libtickit-0.3.4/include/tickit.h 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/include/tickit.h 2020-03-02 19:11:02.000000000 +0000 @@ -26,7 +26,7 @@ #define TICKIT_VERSION_MAJOR 0 #define TICKIT_VERSION_MINOR 3 -#define TICKIT_VERSION_PATCH 4 +#define TICKIT_VERSION_PATCH 5 int tickit_version_major(void); int tickit_version_minor(void); diff -Nru libtickit-0.3.4/Makefile libtickit-0.3.5/Makefile --- libtickit-0.3.4/Makefile 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/Makefile 2020-03-02 19:11:02.000000000 +0000 @@ -45,7 +45,7 @@ EXAMPLESOURCES=$(sort $(wildcard examples/*.c)) VERSION_CURRENT=2 -VERSION_REVISION=4 +VERSION_REVISION=5 VERSION_AGE=0 PREFIX=/usr/local @@ -72,6 +72,10 @@ src/linechars.inc: src/linechars.inc.PL perl $^ > $@ +src/utf8.lo: src/fullwidth.inc +src/fullwidth.inc: src/fullwidth.inc.PL + perl $^ > $@ + t/%.t: t/%.lo $(LIBRARY) t/taplib.lo t/mockterm.lo t/taplib-tickit.lo $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $^ $(LDFLAGS) diff -Nru libtickit-0.3.4/README.md libtickit-0.3.5/README.md --- libtickit-0.3.4/README.md 1970-01-01 00:00:00.000000000 +0000 +++ libtickit-0.3.5/README.md 2020-03-02 19:11:02.000000000 +0000 @@ -0,0 +1,57 @@ +# tickit + +Terminal Interface Construction Kit + +This library provides an abstracted mechanism for building interactive +full-screen terminal programs. It provides a full set of output drawing +functions, and handles keyboard and mouse input events. + +Using this library, applications can: + +- Divide the terminal into a hierarchy of nested, possibly-overlapping + rectangular windows +- Render output content and react to input events independently in any window + region +- Use fully Unicode-aware string content, including non-BMP, fullwidth and + combining characters +- Draw line-art using Unicode box-drawing characters in a variety of styles +- Operate synchronously or asynchronously via file descriptors, or abstractly + via byte buffers +- Recognise arbitrary keyboard input, including modifiers\* +- Make use of multiple terminals, if availble, from a single application + +The following terminal features are supported: + +- Many rendering attributes; bold, italics\*, underline, reverse, + strikethough\*, alternate font\* +- 256 and 24-bit (16million) colours\* +- Mouse including mouse wheel and recognition of position reporting greater + than 224 columns\* +- Arbitrary scrolling regions\* + +\*: Not all terminals may support these features + +## Project Management + +The main project management site, containing bug lists, feature blueprints, +roadmaps, and a mirror of the source code is found on +[Launchpad](https://launchpad.net/libtickit). + +Patches and bug reports are also accepted on GitHub. + +## Documentation + +[Online versions of the manpages](http://www.leonerd.org.uk/code/libtickit/doc/) +are available in HTML form. + +## Source + +The primary upstream revision control system lives in Bazaar at +[http://bazaar.leonerd.org.uk/c/libtickit](http://bazaar.leonerd.org.uk/c/libtickit). + +A fast-import mirror of this is maintained on github at +[https://github.com/leonerd/libtickit](https://github.com/leonerd/libtickit). +Currently this mirror is an experiment at bzr-to-git gatewaying so I don't +guarantee I won't have to force-push this again sometime. + +This is also mirrored by the Launchpad project above. diff -Nru libtickit-0.3.4/src/fullwidth.inc libtickit-0.3.5/src/fullwidth.inc --- libtickit-0.3.4/src/fullwidth.inc 1970-01-01 00:00:00.000000000 +0000 +++ libtickit-0.3.5/src/fullwidth.inc 2020-03-02 19:11:02.000000000 +0000 @@ -0,0 +1,111 @@ + { 0x1100, 0x115f }, + { 0x231a, 0x231b }, + { 0x2329, 0x232a }, + { 0x23e9, 0x23ec }, + { 0x23f0, 0x23f0 }, + { 0x23f3, 0x23f3 }, + { 0x25fd, 0x25fe }, + { 0x2614, 0x2615 }, + { 0x2648, 0x2653 }, + { 0x267f, 0x267f }, + { 0x2693, 0x2693 }, + { 0x26a1, 0x26a1 }, + { 0x26aa, 0x26ab }, + { 0x26bd, 0x26be }, + { 0x26c4, 0x26c5 }, + { 0x26ce, 0x26ce }, + { 0x26d4, 0x26d4 }, + { 0x26ea, 0x26ea }, + { 0x26f2, 0x26f3 }, + { 0x26f5, 0x26f5 }, + { 0x26fa, 0x26fa }, + { 0x26fd, 0x26fd }, + { 0x2705, 0x2705 }, + { 0x270a, 0x270b }, + { 0x2728, 0x2728 }, + { 0x274c, 0x274c }, + { 0x274e, 0x274e }, + { 0x2753, 0x2755 }, + { 0x2757, 0x2757 }, + { 0x2795, 0x2797 }, + { 0x27b0, 0x27b0 }, + { 0x27bf, 0x27bf }, + { 0x2b1b, 0x2b1c }, + { 0x2b50, 0x2b50 }, + { 0x2b55, 0x2b55 }, + { 0x2e80, 0x2e99 }, + { 0x2e9b, 0x2ef3 }, + { 0x2f00, 0x2fd5 }, + { 0x2ff0, 0x2ffb }, + { 0x3000, 0x303e }, + { 0x3041, 0x3096 }, + { 0x3099, 0x30ff }, + { 0x3105, 0x312f }, + { 0x3131, 0x318e }, + { 0x3190, 0x31ba }, + { 0x31c0, 0x31e3 }, + { 0x31f0, 0x321e }, + { 0x3220, 0x3247 }, + { 0x3250, 0x4dbf }, + { 0x4e00, 0xa48c }, + { 0xa490, 0xa4c6 }, + { 0xa960, 0xa97c }, + { 0xac00, 0xd7a3 }, + { 0xf900, 0xfaff }, + { 0xfe10, 0xfe19 }, + { 0xfe30, 0xfe52 }, + { 0xfe54, 0xfe66 }, + { 0xfe68, 0xfe6b }, + { 0xff01, 0xff60 }, + { 0xffe0, 0xffe6 }, + { 0x16fe0, 0x16fe3 }, + { 0x17000, 0x187f7 }, + { 0x18800, 0x18af2 }, + { 0x1b000, 0x1b11e }, + { 0x1b150, 0x1b152 }, + { 0x1b164, 0x1b167 }, + { 0x1b170, 0x1b2fb }, + { 0x1f004, 0x1f004 }, + { 0x1f0cf, 0x1f0cf }, + { 0x1f18e, 0x1f18e }, + { 0x1f191, 0x1f19a }, + { 0x1f200, 0x1f202 }, + { 0x1f210, 0x1f23b }, + { 0x1f240, 0x1f248 }, + { 0x1f250, 0x1f251 }, + { 0x1f260, 0x1f265 }, + { 0x1f300, 0x1f320 }, + { 0x1f32d, 0x1f335 }, + { 0x1f337, 0x1f37c }, + { 0x1f37e, 0x1f393 }, + { 0x1f3a0, 0x1f3ca }, + { 0x1f3cf, 0x1f3d3 }, + { 0x1f3e0, 0x1f3f0 }, + { 0x1f3f4, 0x1f3f4 }, + { 0x1f3f8, 0x1f43e }, + { 0x1f440, 0x1f440 }, + { 0x1f442, 0x1f4fc }, + { 0x1f4ff, 0x1f53d }, + { 0x1f54b, 0x1f54e }, + { 0x1f550, 0x1f567 }, + { 0x1f57a, 0x1f57a }, + { 0x1f595, 0x1f596 }, + { 0x1f5a4, 0x1f5a4 }, + { 0x1f5fb, 0x1f64f }, + { 0x1f680, 0x1f6c5 }, + { 0x1f6cc, 0x1f6cc }, + { 0x1f6d0, 0x1f6d2 }, + { 0x1f6d5, 0x1f6d5 }, + { 0x1f6eb, 0x1f6ec }, + { 0x1f6f4, 0x1f6fa }, + { 0x1f7e0, 0x1f7eb }, + { 0x1f90d, 0x1f971 }, + { 0x1f973, 0x1f976 }, + { 0x1f97a, 0x1f9a2 }, + { 0x1f9a5, 0x1f9aa }, + { 0x1f9ae, 0x1f9ca }, + { 0x1f9cd, 0x1f9ff }, + { 0x1fa70, 0x1fa73 }, + { 0x1fa78, 0x1fa7a }, + { 0x1fa80, 0x1fa82 }, + { 0x1fa90, 0x1fa95 }, diff -Nru libtickit-0.3.4/src/fullwidth.inc.PL libtickit-0.3.5/src/fullwidth.inc.PL --- libtickit-0.3.4/src/fullwidth.inc.PL 1970-01-01 00:00:00.000000000 +0000 +++ libtickit-0.3.5/src/fullwidth.inc.PL 2020-03-02 19:11:02.000000000 +0000 @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +STDOUT->autoflush(1); + +sub iswide +{ + my ( $cp ) = @_; + return chr($cp) =~ m/\p{East_Asian_Width=Wide}|\p{East_Asian_Width=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; diff -Nru libtickit-0.3.4/src/unicode.h libtickit-0.3.5/src/unicode.h --- libtickit-0.3.4/src/unicode.h 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/src/unicode.h 2020-03-02 19:11:02.000000000 +0000 @@ -4,6 +4,7 @@ // With modifications: // made functions static // moved 'combining' table to file scope, so other functions can see it +// use uint32_t instead of wchar_t // ################################################################### /* @@ -67,7 +68,7 @@ * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ -#include +#include struct interval { int first; @@ -129,7 +130,7 @@ /* auxiliary function for binary search in interval table */ -static int bisearch(wchar_t ucs, const struct interval *table, int max) { +static int bisearch(uint32_t ucs, const struct interval *table, int max) { int min = 0; int mid; @@ -176,13 +177,10 @@ * - All remaining characters (including all printable * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. - * - * This implementation assumes that wchar_t characters are encoded - * in ISO 10646. */ -static int mk_wcwidth(wchar_t ucs) +static int mk_wcwidth(uint32_t ucs) { /* test for 8-bit control characters */ if (ucs == 0) @@ -212,3 +210,18 @@ (ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd))); } + +// ################################ +// ### The rest added by Paul Evans + +static const struct interval fullwidth[] = { +#include "fullwidth.inc" +}; + +static int tickit_utf8_wcwidth(uint32_t codepoint) +{ + if(bisearch(codepoint, fullwidth, sizeof(fullwidth) / sizeof(fullwidth[0]) - 1)) + return 2; + + return mk_wcwidth(codepoint); +} diff -Nru libtickit-0.3.4/src/utf8.c libtickit-0.3.5/src/utf8.c --- libtickit-0.3.4/src/utf8.c 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/src/utf8.c 2020-03-02 19:11:02.000000000 +0000 @@ -120,7 +120,7 @@ if(cp < 0x20 || (cp >= 0x80 && cp < 0xa0)) return -1; - int width = mk_wcwidth(cp); + int width = tickit_utf8_wcwidth(cp); if(width == -1) return -1; diff -Nru libtickit-0.3.4/t/01utf8.c libtickit-0.3.5/t/01utf8.c --- libtickit-0.3.4/t/01utf8.c 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/t/01utf8.c 2020-03-02 19:11:02.000000000 +0000 @@ -47,6 +47,16 @@ is_int(pos.graphemes, 1, "tickit_utf8_count UTF-8 fullwidth graphemes"); is_int(pos.columns, 2, "tickit_utf8_count UTF-8 fullwidth columns"); + /* Non-BMP + * U+1F3E0 - HOUSE BUILDING + * 0xf0 0x9f 0x8f 0xa0 + */ + is_int(tickit_utf8_count("\xf0\x9f\x8f\xa0", &pos, NULL), 4, "tickit_utf8_count UTF-8 non-BMP emoji"); + is_int(pos.bytes, 4, "tickit_utf8_count UTF-8 emoji bytes"); + is_int(pos.codepoints, 1, "tickit_utf8_count UTF-8 emoji codepoints"); + is_int(pos.graphemes, 1, "tickit_utf8_count UTF-8 emoji graphemes"); + is_int(pos.columns, 2, "tickit_utf8_count UTF-8 emoji columns"); + /* And now a nice long string */ is_int(tickit_utf8_count("(\xe3\x83\x8e\xe0\xb2\x0a\xe7\xb2\xa0)\xe3\x83\x8e\xe5\xbd\xa1\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb", &pos, NULL), 26, "tickit_utf8_count UTF-8 string"); diff -Nru libtickit-0.3.4/tickit.pc.sh libtickit-0.3.5/tickit.pc.sh --- libtickit-0.3.4/tickit.pc.sh 2020-01-27 00:37:11.000000000 +0000 +++ libtickit-0.3.5/tickit.pc.sh 2020-03-02 19:11:02.000000000 +0000 @@ -9,7 +9,7 @@ Name: tickit Description: Terminal Interface Construction KIT -Version: 0.3.4 +Version: 0.3.5 Libs: $LIBS Cflags: $CFLAGS EOF