GNOME Bugzilla – Bug 356084
Handling surrounding text with selection
Last modified: 2018-02-10 03:24:53 UTC
Currently, "retrieve_surrounding" signal handlers in GtkEntry and GtkTextView always get text at caret position. This is fine in general. However, when text is selected, it should return text before and after selection boundary. The effect of this bug can be found in Thai input method (i.e. with XIM under th_TH locale, or with gtk-im-extra). For example, supposed that "XY" is an illegal sequence, and the surrounding text is Xabc When moving caret to "a" and then <shift>-<Right> to select "abc" X[abc]| The surrounding text returned by current handlers is "Xabc|". Then, if "cY" is allowed, it would allow the illegal "XY" by replacement. Since the selection is to be replaced by next input character, the surrounding text should be returned with the selection removed. That is, it should be just "X|" for above case, or "X|def" for "X[abc]def". Related: Bug #153205
Created attachment 72848 [details] [review] Proposed patch for GtkEntry and GtkTextView This patch gets surrounding text before and after selection bounds and concat them in return. Note that delete_surrounding also needs to start offset at lower bound of selection.
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.