[Uim] Proposal for surrounding text support

TOKUNAGA Hiroyuki tkng at xem.jp
Tue Dec 14 13:28:27 EET 2004


Hi, 

Today, I want to write about uim's surrounding text support.

Currently, uim have no practical surrounding text support. Surrounding
text is need by some languages. For example, Thai input method needs
surrounding text. Of course, surrouding text is worth for CJK.

* GTK+ immodule

GTK+ provides 2 functions for input method. i.e. get_surrounding_text,
delete_surrounding_text. GTK+ doesn't support set/replace surrounding
text. But set/replace features are for text editing rather than for text
inputting, so that's not critical problem.

GTK+'s spec is a bit confusing. If input method call
gtk_im_context_get_surrounding, retrieve_context signal is emitted from
IM Context. Then text widget's callback function such as
'retrieve_context_cb' is called. It responsible for set surrounding text
via gtk_im_context_set_surrounding.


* Qt immodule

Qt immodule also probles get/delete surrounding text.


I propose 4 functions for uim's surrounding text support.

- get_surrounding(uim_context uc, char **text, int *cursor_pos)

- delete_surrounding(uim_context uc, int offset, int n_chars)

- set_surrounding(uim_context uc, const char* text, int cursor_pos)

  It's NOT for text widget, but for input method.

- replace_surrounding(uim_context uc, int offset, int n_chars, 
                                                    char *text, char *cursor_pos)

This function delete surrounding, then set surrounding. I want to use
this for change surrounding text. Delete -> commit is not enough, it
should be atomic. Because if a user press undo button, the character
which he/she inputted would disappeared. That's confusing.


But in this proposal, there are some problems. I want to list up them.

1. Could we get surrounding text in console?

  I don't know yet.

2. Implementation of replace/set surrounding is difficult.

  Should we consider the bridge which doesn't support replace/set
surrounding?

3. Replace surrounding is really need?

  I'm not confident in.


There may be further problems. Any comments are welcome.

Regards,

-- 
TOKUNAGA Hiroyuki
http://kodou.net/



More information about the uim mailing list