1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/test
Simon Tatham b6ef4f18d5 Support Unicode flag glyphs in terminal.c (works in GTK).
This is the only one of the newly added cases in test/utf8.txt which I
can (try to) fix unilaterally just by changing PuTTY's display code,
because it doesn't change the number of character cells occupied by
the text, only the appearance of those cells.

In this commit I make the necessary changes in terminal.c, which makes
flags start working in GTK PuTTY and pterm, but not on Windows.

The system of encoding flags in Unicode is that there's a space of 26
regional-indicator letter code points (U+1F1E6 to U+1F1FF inclusive)
corresponding to the unaccented Latin alphabet, and an adjacent pair
of those letters represents the flag associated with that two-letter
code (usually a nation, although at least one non-nation pair exists,
namely EU).

There are two plausible ways we could handle this in terminal.c:

  (a) leave the regional indicators as they are in the internal data
      model, so that each RI letter occupies its own character cell,
      and at display time have do_paint() spot adjacent pairs of them
      and send each pair to the frontend as a combined glyph.

  (b) combine the pairs _in_ the internal data model, by
      special-casing them in term_display_graphic_char().

This choice makes a semantic difference. What if a flag is displayed
in the terminal and something overprints one of its two character
cells? With option (a), overprinting one cell of an RI pair with a
different RI letter would change it into a different flag; with
option (b), flags behave like any other wide character, in that
overprinting one of the two cells blanks the other as a side effect.

I think we need (a), because not all terminal redraw systems
(curses-style libraries) will understand the Unicode flag glyph system
at all. So if a full-screen application genuinely wants to do a screen
redraw in which a flag changes to a different flag while keeping one
of its constituent letters the same (say, swapping between BA and CA,
or between AC and AD), then the redraw library might very well
implement that screen update by redrawing only the changed letter, and
we need not to corrupt the flag.

All of this is now implemented in terminal.c. The effect is that pairs
of RI characters are passed to the TermWin draw_text() method as if
they were a wide character with a combining mark: that is, you get a
two-character (or four-surrogate) string, with TATTR_COMBINING
indicating that it represents a single glyph, and ATTR_WIDE indicating
that that glyph occupies two character cells rather than one.

In GTK, that's enough to make flag display Just Work. But on
Windows (at least the Win10 machine I have to test on), that doesn't
make flags start working all by itself. But then, the rest of the new
emoji tests also look a bit confused on Windows too. Help would be
welcome from someone who knows how Windows emoji display is supposed
to work!
2024-05-06 13:36:40 +01:00
..
sclog Side-channel tester: align memory allocations. 2024-04-01 13:10:49 +01:00
agentmulti.py Add test script for simultaneous agent connections. 2021-05-24 15:27:38 +01:00
agenttest.py Migrate all Python scripts to Python 3. 2020-03-04 21:23:49 +00:00
agenttestdata.py New test script 'agenttest.py' for testing Pageant. 2020-01-09 19:57:35 +00:00
agenttestgen.py RSA generation: option to generate strong primes. 2020-03-07 11:37:31 +00:00
ca.py test/ca.py: fix handling of RFC4716 public key files. 2022-07-30 15:01:09 +01:00
colours.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
cryptsuite.py Merge 0.81 branch. 2024-04-15 19:42:50 +01:00
desref.py Migrate all Python scripts to Python 3. 2020-03-04 21:23:49 +00:00
display.txt Add SGR 9 strikethrough to test file. 2020-08-13 23:54:58 +01:00
dsa_nonce_recover.py dsa_nonce_recover.py: feature to talk to an agent. 2024-04-07 13:23:37 +01:00
eccref.py Migrate all Python scripts to Python 3. 2020-03-04 21:23:49 +00:00
fuzzterm.c New centralised version of local line editing. 2023-03-04 13:55:50 +00:00
lattrs.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
list-accel.py Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
mpu-check.pl Generate MPU certificates for proven primes. 2020-03-07 11:24:12 +00:00
numbertheory.py test/numbertheory.py: fix comment wording. 2020-05-03 11:18:50 +01:00
primegen.py primegen.py: add a --probabilistic option. 2021-08-28 10:17:16 +01:00
scocols.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
ssh.py Test implementation of a CA in Python. 2022-04-25 15:09:31 +01:00
test_conf.c Centralise defaults for non-saved options. 2023-09-22 16:42:47 +01:00
test_lineedit.c Run test_lineedit and test_terminal in the main build. 2023-03-05 10:26:45 +00:00
test_terminal.c Run test_lineedit and test_terminal in the main build. 2023-03-05 10:26:45 +00:00
testcrypt-enum.h Add support for HMAC-SHA512. 2023-04-23 13:24:19 +01:00
testcrypt-func.h Merge 0.81 branch. 2024-04-15 19:42:50 +01:00
testcrypt.c testcrypt: allow null return from ssh2_mac_new. 2023-08-22 19:36:05 +01:00
testcrypt.py Implement OpenSSH 9.x's NTRU Prime / Curve25519 kex. 2022-04-15 17:46:06 +01:00
testsc.c testsc: fix disorganised alloc/free in test_hash(). 2024-04-06 09:31:12 +01:00
testzlib.c Move some tests into the test subdirectory. 2021-11-22 19:11:53 +00:00
utf8.txt Support Unicode flag glyphs in terminal.c (works in GTK). 2024-05-06 13:36:40 +01:00
vt100.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
windowchange.py Test program for ancillary window updates. 2021-02-07 19:59:21 +00:00