After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 356084 - Handling surrounding text with selection
Handling surrounding text with selection
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-09-15 07:09 UTC by Theppitak Karoonboonyanan
Modified: 2018-02-10 03:24 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed patch for GtkEntry and GtkTextView (3.75 KB, patch)
2006-09-15 11:50 UTC, Theppitak Karoonboonyanan
none Details | Review

Description Theppitak Karoonboonyanan 2006-09-15 07:09:00 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
Comment 1 Theppitak Karoonboonyanan 2006-09-15 11:50:41 UTC
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.
Comment 2 Matthias Clasen 2018-02-10 03:24:53 UTC
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.