simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Mar 4 14:09:30 GMT 2023
TL;DR:
fd43ff6e Move SessionSpecial definitions into their own header.
7a488374 Add a test rig for ldisc's local line editing.
1a7e4ec8 New centralised version of local line editing.
f9943e2f term_get_userpass_input: support the prompts->utf8 flag.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2023-03-04 14:09:30
commit fd43ff6e278d8355fd3f0cf68bae11ad14e98881
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=fd43ff6e278d8355fd3f0cf68bae11ad14e98881;hp=b5645f79ddadeecfe15c4db24b64a0afc48fca4a
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 4 12:56:24 2023 +0000
Move SessionSpecial definitions into their own header.
This will allow me to re-include it elsewhere, to make an array of the
specials' names for diagnostic purposes.
putty.h | 58 +++++-----------------------------------------------------
specials.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 53 deletions(-)
commit 7a48837471dbaf29a07c0fe0a08d37fbfb5f9b94
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=7a48837471dbaf29a07c0fe0a08d37fbfb5f9b94;hp=fd43ff6e278d8355fd3f0cf68bae11ad14e98881
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 4 12:57:03 2023 +0000
Add a test rig for ldisc's local line editing.
I'm about to rewrite it completely, so the first thing I need to do is
to write tests for as much of the functionality as possible, so that I
can check the new implementation behaves in the same ways.
test/test_lineedit.c | 735 +++++++++++++++++++++++++++++++++++++++++++++++++
unix/CMakeLists.txt | 10 +
unix/platform.h | 1 +
windows/CMakeLists.txt | 11 +
windows/platform.h | 1 +
5 files changed, 758 insertions(+)
commit 1a7e4ec8d499fb0691264c9cbc995f3c4d781b37
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=1a7e4ec8d499fb0691264c9cbc995f3c4d781b37;hp=7a48837471dbaf29a07c0fe0a08d37fbfb5f9b94
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 4 12:56:01 2023 +0000
New centralised version of local line editing.
This takes over from both the implementation in ldisc.c and the one in
term_get_userpass_input, which were imperfectly duplicating each
other's functionality. The new version should be more consistent
between the two already, and also, it means further improvements can
now be made in just one place.
In the course of this, I've restructured the inside of ldisc.c by
moving the input_queue bufchain to the other side of the translation
code in ldisc_send. Previously, ldisc_send received a string, an
optional 'dedicated key' indication (bodgily signalled by a negative
length) and an 'interactive' flag, translated that somehow into a
combination of raw backend output and specials, and saved the latter
in input_queue. Now it saves the original (string, dedicated flag,
interactive flag) data in input_queue, and doesn't do the translation
until the data is pulled back _out_ of the queue. That's because the
new line editing system expects to receive something much closer to
the original data format.
The term_get_userpass_input system is also substantially restructured.
Instead of ldisc.c handing each individual keystroke to terminal.c so
that it can do line editing on it, terminal.c now just gives the Ldisc
a pointer to its instance of the new TermLineEditor object - and then
ldisc.c can put keystrokes straight into that, in the same way it
would put them into its own TermLineEditor, without having to go via
terminal.c at all. So the term_get_userpass_input edifice is only
called back when the line editor actually delivers the answer to a
username or password prompt.
(I considered not _even_ having a separate TermLineEditor for password
prompts, and just letting ldisc.c use its own. But the problem is that
some of the behaviour differences between the two line editors are
deliberate, for example the use of ^D to signal 'abort this prompt',
and the use of Escape as an alternative line-clearing command. So
TermLineEditor has a flags word that allows ldisc and terminal to set
it up differently. Also this lets me give the two TermLineEditors a
different vtable of callback functions, which is a convenient way for
terminal.c to get notified when a prompt has been answered.)
The new line editor still passes all the tests I wrote for the old
one. But it already has a couple of important improvements, both in
the area of UTF-8 handling:
Firstly, when we display a UTF-8 character on the terminal, we check
with the terminal how many character cells it occupied, and then if
the user deletes it again from the editing buffer, we can emit the
right number of backspace-space-backspace sequences. (The old ldisc
line editor incorrectly assumed all Unicode characters had terminal
with 1, partly because its buffer was byte- rather than character-
oriented and so it was more than enough work just finding where the
character _start_ was.)
Secondly, terminal.c's userpass line editor would never emit a byte in
the 80-BF range to the terminal at all, which meant that nontrivial
UTF-8 characters always came out as U+FFFD blobs!
CMakeLists.txt | 5 +-
defs.h | 5 +
ldisc.c | 652 ++++++++++++++++++---------------------------------
putty.h | 23 +-
stubs/no-lineedit.c | 18 ++
terminal/lineedit.c | 520 ++++++++++++++++++++++++++++++++++++++++
terminal/terminal.c | 236 +++++++++++--------
terminal/terminal.h | 48 ++++
test/fuzzterm.c | 5 +-
test/test_lineedit.c | 30 ++-
10 files changed, 989 insertions(+), 553 deletions(-)
commit f9943e2ffdbbb2529ec5f7c1ea569fe4ee40a6a7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f9943e2ffdbbb2529ec5f7c1ea569fe4ee40a6a7;hp=1a7e4ec8d499fb0691264c9cbc995f3c4d781b37
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 4 13:37:13 2023 +0000
term_get_userpass_input: support the prompts->utf8 flag.
This continues the programme of UTF-8 support in authentication, begun
in commit f4519b6533b089d which arranged for console userpass prompts
to function in UTF-8 when the prompts_t asked them to. Since the new
line editing setup works properly when it _is_ in UTF-8 mode, I can
now also arrange that it puts the terminal into UTF-8 mode in the
right circumstances.
I've extended the applicability of the '-legacy-charset-handling' flag
introduced by the commit mentioned above, so that now it's not
specific to the console front end. Now you can give it to GUI PuTTY as
well, which restores the previous (wrong) behaviour of accepting
username and password prompt input in the main session's configured
character set. So if this change breaks someone's workflow, they
should be able to have it back.
cmdline.c | 2 +-
putty.h | 6 +++++-
stubs/no-console.c | 5 -----
terminal/terminal.c | 8 ++++++++
terminal/terminal.h | 8 ++++++--
unix/console.c | 2 +-
windows/console.c | 2 +-
7 files changed, 22 insertions(+), 11 deletions(-)
More information about the tartarus-commits
mailing list