simon-git: putty (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Apr 5 21:38:59 BST 2025


TL;DR:
  fbea30bb GTK: trivially handle preedit signals
  227b9ae4 GTK: also log the preedit string
  194ca31c Add an API for passing pre-edit text to terminal; call from GTK
  35caff40 Decode UTF-8 in pre-edit text
  ab9dfc57 Very crude support for displaying pre-edit strings
  b72fec0a Display some IM pre-edit state when painting the terminal
  3ab279fa Minimal viable pre-edit support
  f9928fb7 Initialise pre-edit character cells to basic_erase_char
  29ac4da8 Support longer pre-edit text
  3bbde58c Properly hide existing combining characters with pre-edit text
  47768857 Use a little termline to store pre-edit text
  d8493c11 Construct preedit_termline incrementally
  6532408b Support combining characters in pre-edit strings
  4f4f752e Put the cursor at the right-hand end of the pre-edit string
  fee59479 Remove recently-added debug() calls from terminal.c

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2025-04-05 21:38:59

commit fbea30bbaf0af1226959a0ba1bb98724e456b129
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=fbea30bbaf0af1226959a0ba1bb98724e456b129;hp=6332497afb798448a5cd744aa7026822823f201b
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Mar 26 20:13:54 2025 +0000

    GTK: trivially handle preedit signals
    
    At present, that just means logging them when KEY_EVENT_DIAGNOSTICS is
    defined.

 unix/window.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

commit 227b9ae470d3c934f50570454db11586d6845945
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=227b9ae470d3c934f50570454db11586d6845945;hp=fbea30bbaf0af1226959a0ba1bb98724e456b129
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Mar 26 20:49:00 2025 +0000

    GTK: also log the preedit string

 unix/window.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

commit 194ca31cc3572497cf11feb0114a17828d3ad498
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=194ca31cc3572497cf11feb0114a17828d3ad498;hp=227b9ae470d3c934f50570454db11586d6845945
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Mar 30 14:02:37 2025 +0100

    Add an API for passing pre-edit text to terminal; call from GTK
    
    The terminal code doesn't yet do anything with the text other than feed
    it to a debugging printf.  The call uses UTF-8 and expects the terminal
    to copy the string because that's compatible with
    gtk_im_context_get_preedit_string().

 putty.h             |  1 +
 terminal/terminal.c | 10 ++++++++++
 unix/window.c       |  2 ++
 3 files changed, 13 insertions(+)

commit 35caff40488002c731aec3d92d98a3fc1a082d4f
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=35caff40488002c731aec3d92d98a3fc1a082d4f;hp=194ca31cc3572497cf11feb0114a17828d3ad498
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Mar 30 15:05:31 2025 +0100

    Decode UTF-8 in pre-edit text
    
    This is a pre-requisite to rendering it somehow.

 terminal/terminal.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

commit ab9dfc572e4759b3304c47e7914af87306f340f6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ab9dfc572e4759b3304c47e7914af87306f340f6;hp=35caff40488002c731aec3d92d98a3fc1a082d4f
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Mar 30 16:45:25 2025 +0100

    Very crude support for displaying pre-edit strings
    
    We simply pass each character to term_display_graphic_char and then
    put the cursor back where we found it.  This works in simple cases,
    but is fundamentally wrong.  Really we should do this in a way that
    doesn't touch the terminal state and just gets rendered on top of it
    somehow.

 terminal/terminal.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

commit b72fec0a52a921b747d3f09b8792c05e574d0998
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b72fec0a52a921b747d3f09b8792c05e574d0998;hp=ab9dfc572e4759b3304c47e7914af87306f340f6
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Mar 31 10:04:18 2025 +0100

    Display some IM pre-edit state when painting the terminal
    
    This is approximately how it should work: term_set_preedit_text stashes
    data in the terminal structure and then do_paint() renders it in place
    of what's in the terminal buffer.  Currently this only works for a
    single narrow character, and it copies the existing attributes under the
    cursor, but this might actually be enough for the UK keyboard layout in
    GNOME.

 terminal/terminal.c | 14 +++++++++-----
 terminal/terminal.h |  3 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

commit 3ab279fae50a64a108054537c4bd44812f953e49
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3ab279fae50a64a108054537c4bd44812f953e49;hp=b72fec0a52a921b747d3f09b8792c05e574d0998
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Apr 1 23:01:46 2025 +0100

    Minimal viable pre-edit support
    
    Now we can cope with a single wide or narrow pre-edit character, which
    is good enough for the input methods that I use.  When rendering the
    line that contains the cursor we set up a little array of termchars
    that contains the pre-edit text and work out where it should be
    displayed.  Then when rendering the screen we switch between
    displaying text from the real terminal and from the pre-edit string as
    necessary.
    
    Ideally, we should support longer strings, combining characters, and
    setting attributes.  I think the current architecture should make all
    of those possible, but not entirely easy.

 terminal/terminal.c | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

commit f9928fb7d5ef8794bd81ea81d4c9026f4885b6f9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f9928fb7d5ef8794bd81ea81d4c9026f4885b6f9;hp=3ab279fae50a64a108054537c4bd44812f953e49
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Apr 2 01:21:40 2025 +0100

    Initialise pre-edit character cells to basic_erase_char
    
    This ensures that they have sensible attributes (not black on black)
    and is simpler than initialising the fields by hand.

 terminal/terminal.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

commit 29ac4da8fb473126c12cb1db315738d6735a6706
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=29ac4da8fb473126c12cb1db315738d6735a6706;hp=f9928fb7d5ef8794bd81ea81d4c9026f4885b6f9
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Apr 2 10:06:22 2025 +0100

    Support longer pre-edit text
    
    Now the pre-edit text is converted into a dynamically-allocated array of
    termchars in term_set_preedit_text(), which slightly simplifies
    do_paint().  This means that the long pre-edit generated by Ctrl+Shift+U
    in GNOME now displays more or less properly.  I may need a better plan
    for what to do about cursor positioning, though.

 terminal/terminal.c | 52 +++++++++++++++++++++++++++++++---------------------
 terminal/terminal.h |  3 ++-
 2 files changed, 33 insertions(+), 22 deletions(-)

commit 3bbde58c098b0afca6c8a5c56cc1ea71f7eaafc5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3bbde58c098b0afca6c8a5c56cc1ea71f7eaafc5;hp=29ac4da8fb473126c12cb1db315738d6735a6706
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 15:47:52 2025 +0100

    Properly hide existing combining characters with pre-edit text
    
    If a character cell under the pre-edit text has a combining character,
    it shouldn't be combined with a character from the pre-edit text, but
    should be hidden instead.  This also means that the pre-edit text
    could contain combining characters if I implemented a way to put them
    into it.

 terminal/terminal.c | 4 ++++
 1 file changed, 4 insertions(+)

commit 477688576784b5fea027a14badd1e9b97923c0be
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=477688576784b5fea027a14badd1e9b97923c0be;hp=3bbde58c098b0afca6c8a5c56cc1ea71f7eaafc5
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 16:00:00 2025 +0100

    Use a little termline to store pre-edit text
    
    I think supporting combining characters in pre-edit text will be simpler
    if I can use add_cc, which operated on termlines.  Also we have code for
    resizing termlines, which means I might not need to count the width of
    the pre-edit string accurately before allocating it.

 terminal/terminal.c | 34 +++++++++++++++-------------------
 terminal/terminal.h |  3 +--
 2 files changed, 16 insertions(+), 21 deletions(-)

commit d8493c11cd6e774077b9318e801bfa99525d0c98
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d8493c11cd6e774077b9318e801bfa99525d0c98;hp=477688576784b5fea027a14badd1e9b97923c0be
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 16:20:52 2025 +0100

    Construct preedit_termline incrementally
    
    This involves repeatedly resizing it as we decode characters.  That's a
    bit inefficient (at least with the current implementation of
    resizeline()), but it makes it much easier to be certain that the line
    is actually the right length.

 terminal/terminal.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

commit 6532408ba564b3e94c0a5319b58f73915eb08fa9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6532408ba564b3e94c0a5319b58f73915eb08fa9;hp=d8493c11cd6e774077b9318e801bfa99525d0c98
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 18:35:57 2025 +0100

    Support combining characters in pre-edit strings
    
    Having the pre-edit string in a termline makes this almost trivial.

 terminal/terminal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

commit 4f4f752e47d88fa732c31d6d09545f44e303c72d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4f4f752e47d88fa732c31d6d09545f44e303c72d;hp=6532408ba564b3e94c0a5319b58f73915eb08fa9
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 20:26:20 2025 +0100

    Put the cursor at the right-hand end of the pre-edit string
    
    That's the more logical location in a string more than one character
    long.  GTK does actually tell us where it thinks the cursor should be,
    but we don't yet pay attention to that.

 terminal/terminal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

commit fee594798f6f81eb6489e8fb6eff68f65e3198b2
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=fee594798f6f81eb6489e8fb6eff68f65e3198b2;hp=4f4f752e47d88fa732c31d6d09545f44e303c72d
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Apr 5 21:22:43 2025 +0100

    Remove recently-added debug() calls from terminal.c

 terminal/terminal.c | 6 ------
 1 file changed, 6 deletions(-)



More information about the tartarus-commits mailing list