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 270248 - add support for Surrounding text in input
add support for Surrounding text in input
Status: RESOLVED FIXED
Product: GtkHtml
Classification: Other
Component: Editing
3.7.x
Other All
: Normal normal
: 2.9
Assigned To: evolution-calendar-maintainers
Evolution QA team
evolution[composer]
Depends on: 353192
Blocks:
 
 
Reported: 2004-12-06 11:21 UTC by Anuradha Ratnaweera
Modified: 2006-08-28 14:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch fixing surrounding text support. (1.19 KB, patch)
2006-08-28 11:06 UTC, Theppitak Karoonboonyanan
committed Details | Review

Description Anuradha Ratnaweera 2004-12-06 11:21:46 UTC
Composer that comes with Evolution 2.0.2 doesn't seem to have surrounding
text support (i.e.: gtk_im_context_{get,delete}_surroundings()).  Input
method modules that use these functions are not working properly.

Steps to reproduce the problem:
1. Install any input method that uses surrounding text (e.g.: Sinhala
Transliterated input from http://sinhala.linux.lk/pub/ ).
2. Type any key that require surrounding text (say "ki" in Sinhala).

This takes each keys individually, and doesn't produce different input
depending on the context.

The expected result is for some keys to behave differently depending on
their surroundings.

This is not a random bug.
Comment 1 Rodney Dawes 2005-01-27 00:38:52 UTC
This is only an i18n bug. The composer needs to deal with doing
non-english input correctly obviously
Comment 2 JP Rosevear 2005-01-31 18:03:12 UTC
Why did this get marked future?  I believe rodo made this work for
2.0, so maybe it regressed or there are still issues.
Comment 3 Radek Doulik 2005-02-23 18:19:38 UTC
ok, that indeed doesn't work and triggers assertions

(lt-test_editor:28985): Gtk-CRITICAL **: file gtkimcontext.c: line 451
(gtk_im_context_set_surrounding): assertion `text != NULL || len == 0'
failed
 
(lt-test_editor:28985): Gtk-CRITICAL **: file gtkimcontext.c: line 451
(gtk_im_context_set_surrounding): assertion `text != NULL || len == 0'
failed
 
(lt-test_editor:28985): Gtk-CRITICAL **: file gtkimcontext.c: line 451
(gtk_im_context_set_surrounding): assertion `text != NULL || len == 0'
failed

but I doubt it's regression.
Comment 4 Anuradha Ratnaweera 2005-05-12 09:34:18 UTC
GTK widgets that input text are supposed to implement gtk_im_get_surrounding and
gtk_im_delete_surrounding.  Looks like the text composing widget in Evolution
composer is not implementing it.

We are trying workarounds, and here is a post from Owen Taylor on the matter:

http://www.mail-archive.com/gtk-i18n-list@gnome.org/msg00037.html
Comment 5 Not Zed 2005-08-04 09:10:30 UTC
not mailer code
Comment 6 André Klapper 2005-09-28 01:19:49 UTC
retargetting to 2.5
Comment 7 Theppitak Karoonboonyanan 2006-08-28 11:04:35 UTC
It seems surrounding text support has been in 2.7 or before. But it's still buggy. For example, it crashes when actually called, as reported in Bug #353192. However, even the crasher is fixed, there remain a few logical flaws in the code 
(gtkhtml.c):

First, get_surrounding_text() always returns NULL. Everything in it seems OK, 
except for the line:

    text = g_strconcat (text, HTML_TEXT (o)->text, NULL);

Since "text" was initialized with NULL, g_strconcat() takes the first NULL 
argument as argument list terminator. Thus, it's always remains NULL along 
the loop. Besides, even if it is fixed to be non-NULL before that, it will 
still suffer from memory leak, as the old copy is discarded, replaced by
the one newly allocated by g_strconcat().

Second, in gtk_html_im_retrieve_surrounding_cb(), the call to 
gtk_im_context_set_surrounding() is supplied with character offset as the
last argument, while the API requires byte offset.
Comment 8 Theppitak Karoonboonyanan 2006-08-28 11:06:06 UTC
Created attachment 71761 [details] [review]
Patch fixing surrounding text support.
Comment 9 Veerapuram Varadhan 2006-08-28 13:53:47 UTC
(In reply to comment #8)
> Created an attachment (id=71761) [edit]
> Patch fixing surrounding text support.
> 
Patch looks good. Please commit it to both HEAD and CVS.  Once committed, please mark the patch as committed and close this bug and the other one as well.
Comment 10 Theppitak Karoonboonyanan 2006-08-28 14:22:37 UTC
Patch committed to HEAD and gnome-2-14 branch. However, I do not have permission to close this bug, nor to update status of my patch.
Comment 11 André Klapper 2006-08-28 14:40:52 UTC
closing on behalf of thep