Bug 1847347 - Input Method "surrounding" Events [NEEDINFO]
Summary: Input Method "surrounding" Events
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: vte291
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-16 09:16 UTC by Mike FABIAN
Modified: 2023-05-15 10:37 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:
petersen: needinfo? (mfabian)


Attachments (Terms of Use)
screenshot1.png (246.08 KB, image/png)
2020-06-16 09:16 UTC, Mike FABIAN
no flags Details
screenshot2.png (256.18 KB, image/png)
2020-06-16 09:17 UTC, Mike FABIAN
no flags Details
screenshot3.png (252.78 KB, image/png)
2020-06-16 09:17 UTC, Mike FABIAN
no flags Details
Screencast from 06-16-2020 10:51:39 AM.webm (289.97 KB, application/octet-stream)
2020-06-16 09:19 UTC, Mike FABIAN
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNOME Gitlab GNOME vte issues 214 0 None None None 2021-05-20 21:48:26 UTC

Description Mike FABIAN 2020-06-16 09:16:06 UTC
I made the following screenshots and video by testing on Gnome-Xorg, but the problem occurs on Gnome-Wayland as well.

How to reproduce (see also attached screenshots and video):

- To show what happens with the surrounding text, I first opened the
  setup tool of ibus-typing-booster and set the debug level in the
  options tab to 3.

  When the debug level is high, the auxiliary text above the candidate
  list shows what context has been obtained by using surrounding text
  (if surrounding text is available, if it is not available like when
  using xterm, the context is just remembered from what was typed
  last).

- I opened 3 windows: gedit, firefox, and gnome-terminal.

- I focus on gedit and type "a b c d e"

  On top of the candidate list one can see: "Context: b c d"

  This is because when the letter "e" was typed, ibus-typing-booster
  got the surrounding text at the cursor position and parsed the last
  3 tokens left of the cursor out of the result. And these
  last 3 tokens left of the cursor are "b c d".

- Now I focus on firefox and type "f g h i j"

  On top of the candidate list one can see: "Context: g h i"

  I.e. the correct context "g h i" to the left of the just typed "j"
  (which is still in preedit) has been found using surrounding text.

- Now I focus on gnome-terminal and type "k l m"

  On top of the candidate list one can see: "Context h i j"

  This comes from the surrounding text left of the cursor in
  *firefox*, *not* from gnome-terminal.

  Although gnome-terminal reports that surrounding text is supported, i.e.
  
     self.client_capabilities & IBus.Capabilite.SURROUNDING_TEXT

  is True (see the code to get the context at:
  
      https://github.com/mike-fabian/ibus-typing-booster/blob/master/engine/hunspell_table.py#L2497

  )

  gnome-terminal does not really seem to support surrounding text.
  The surrounding text comes from the previous client which really supported
  surrounding text.

  If the previous client was firefox, one still gets the surrounding text from
  firefox while typing in gnome-terminal.

  Same with gedit, if the previous client before focussing on gnome-terminal
  was gedit, one still gets the surrounding text from gedit while typing in
  gnome-terminal.


- The same problem occurs when using xfce4-terminal instead of gnome-terminal.

- When using xterm, the problem does *not* occur because when using xterm

      self.client_capabilities & IBus.Capabilite.SURROUNDING_TEXT
      
  is False and then the get_context() immediately returns and the context
  remembered from the last text typed is used as a fallback.

Comment 1 Mike FABIAN 2020-06-16 09:16:46 UTC
Created attachment 1697573 [details]
screenshot1.png

Comment 2 Mike FABIAN 2020-06-16 09:17:21 UTC
Created attachment 1697574 [details]
screenshot2.png

Comment 3 Mike FABIAN 2020-06-16 09:17:53 UTC
Created attachment 1697575 [details]
screenshot3.png

Comment 4 Mike FABIAN 2020-06-16 09:19:19 UTC
Created attachment 1697577 [details]
Screencast from 06-16-2020 10:51:39 AM.webm

Video showing how screenshot1.png, screenshot2.png, and screenshot3.png were created.

Comment 5 fujiwara 2020-06-18 11:54:43 UTC
Unfortunately VTE does not implement "retrieve-surrounding" signal:

https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/vte.cc#L4380

https://bugzilla.gnome.org/show_bug.cgi?id=726191

https://gitlab.gnome.org/GNOME/vte/-/issues/214

Instead, GtkTextView calls gtk_im_context_set_surrounding() in gtk_text_view_retrieve_surrounding_handler() with "retrieve-surrounding" signal.

Comment 6 Mike FABIAN 2021-03-12 15:04:14 UTC
This bug still exists in Fedora 34.

Comment 7 Ben Cotton 2022-05-12 15:59:57 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 8 Mike FABIAN 2022-05-30 06:16:41 UTC
https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/vte.cc#L4423

Still has empty stubs ofr retrieving and deleting surrounding text:

bool
Terminal::im_retrieve_surrounding()
{
        /* FIXME: implement this! Bug #726191 */
        return false;
}

bool
Terminal::im_delete_surrounding(int offset,
                                int n_chars)
{
        /* FIXME: implement this! Bug #726191 */
        return false;
}

Comment 9 Ben Cotton 2023-04-25 16:40:20 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Jens Petersen 2023-05-15 10:36:46 UTC
I recommend to open a new upstream bug to track this, please


Note You need to log in before you can comment on or make changes to this bug.