Andy, Looking at Gtk code on: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextview.c -> gtk_text_view_retrieve_surrounding_handler
It seems to concat 3 words backwards + selection + 3 words forward (there are more complicated cases). I was looking around on JavaFX code and it does not seem to support this feature (surrounding). I don't know if Windows and/or Mac supports it. If implemented it should work for all text input controls. Gtk seems to have been adopting relative window positioning for everything as opposed to Screen positioning and InputMethodRequests.getTextLocation is absolute. Would be nice to have the relative value. -- Thiago Em sex., 9 de jun. de 2023 às 12:49, Andy Goryachev < andy.goryac...@oracle.com> escreveu: > 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.sa...@gmail.com> > *Date: *Friday, June 9, 2023 at 03:54 > *To: *Andy Goryachev <andy.goryac...@oracle.com>, openjfx-dev < > openjfx-dev@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. >