[External] : Text Surrounding

Andy Goryachev andy.goryachev at oracle.com
Fri Jun 9 15:48:58 UTC 2023


Thiago:

The IME support is in the plans, so thank you for the info.  I am not there yet, but at least I can ask one question regarding the "surrounding" feature: how much text does it expect from the control?  Is one line or paragraph enough?

Let me ask another question: is the current IME support in TextArea/TextField adequate?

Thank you
-andy




From: Thiago Milczarek Sayão <thiago.sayao at gmail.com>
Date: Friday, June 9, 2023 at 03:54
To: Andy Goryachev <andy.goryachev at oracle.com>, openjfx-dev <openjfx-dev at openjdk.org>
Subject: [External] : Text Surrounding
Hi Andy,

I understand you're working on a Rich Text control.

While working on IME (Input Method Editor) for Linux, I noticed that there is a feature called "surrounding"
that it supports to give the IME information about the text being inputted. More info here:

https://docs.gtk.org/gtk3/class.IMContext.html<https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/class.IMContext.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2HOZmTlw$>

It works like this:

When user is typing using an IME language, the underlying IME (for example https://github.com/tlwg/ibus-libthai<https://urldefense.com/v3/__https:/github.com/tlwg/ibus-libthai__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2kBsHxAM$>)
may ask the Toolkit for the surrounding text and it should reply with:

https://docs.gtk.org/gtk3/method.IMContext.set_surrounding.html<https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/method.IMContext.set_surrounding.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2cQl7mM8$>

That contains:
- The text
- The length
- The cursor position within the text

So this way the underlying IME can provide accurate suggestions using the user context.

That would be a nice feature to have but it requires some work to retrieve it from the text-based control.

Just letting you know about this, it may be out of the scope of your rich text work for now.

-- Thiago.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230609/d21950eb/attachment-0001.htm>


More information about the openjfx-dev mailing list