[Uim] surrounding text
YAMAMOTO Kengo / YamaKen
yamaken at bp.iij4u.or.jp
Sat Oct 7 08:10:13 EEST 2006
Hi Etsushi, I've finished the API generalization.
> At Fri, 6 Oct 2006 21:38:27 +0900,
> ek.kato at gmail.com wrote:
> >
> > BTW, for API in IM side, maybe it doesn't need to divide
> > im-request-surrounding and im-get-surrounding. Combining these two
> > procedure and just returning #f or ("former" "latter") seems to be
> > simple.
Since the "former and latter text" interface is also adopted by
surrounding text support of composer framework (it's still alive
although the development is being stalled near one year), it is
better for uim API than the GTK+-like interface.
Please review the patch attached to. Though I said you about an
unified interface for these text acquisitions, I separated
string input as an independent interface to simplify internal
implementations after some considerations. This API is supposed
to work as follows.
scenario #1: acquiring surrounding text
1) Having a text "predecingIfollowing" on the textarea ("I" denotes cursor)
2) (im-acquire-text c 'primary 'cursor 12 12)
3) uc->acquire_text_cb(uc, UTextArea_Primary, UTextOrigin_Cursor, 12, 12)
4) Returns result of (ustr-new '("preceding") '("following"))
5) Split 3) into characters if needed
scenario #2: acquiring full text for Japanese morphological analysis
1) (im-acquire-text c 'primary 'end 'full 0)
2) uc->acquire_text_cb(uc, UTextArea_Primary, UTextOrigin_End,
UTextExtent_Full, 0)
3) Returns result of (ustr-new '("full text of the primary textarea") '())
4) Analyze ustr-former-seq of 3) to select dictionary, or tune
internal conversion parameters (assuming uim-anthy or uim-prime)
scenario #3: reconversion of selection text by uim-anthy
1) Select a text region by mouse
2) Input a key that matches against anthy-reconversion-key?
3) (im-acquire-text ac 'selection 'end 'full 0)
4) uc->acquire_text_cb(uc, UTextArea_Selection, UTextOrigin_End,
UTextExtent_Full, 0)
5) The bridge returns selected text
6) Returns result of (ustr-new '("text to be reconverted") '())
7) (im-delete-text ac 'selection 'end 'full 0)
8) uc->delete_text_cb(uc, UTextArea_Selection, UTextOrigin_End,
UTextExtent_Full, 0)
9) The bridge deletes selected text
10) Reconvert ustr-former-seq of 9)
scenario #4: insert a text read from clipboard into preedit by uim-skk
1) Convert a text and fall into word-registering mode
2) Look up the kanji-word of 1) by a dictionary application
3) Select the kanji-word 2)
4) Re-select the textarea 1)
5) Input a key that matches against skk-yank-from-clipboard?
6) (im-acquire-text sc 'clipboard 'end 'full 0)
7) uc->acquire_text_cb(uc, UTextArea_Clipboard, UTextOrigin_End,
UTextExtent_Full, 0)
8) The bridge acquire the text of clipboard copied at 3)
9) Returns result of (ustr-new '("the kanji-word") '())
10) Yank the kanji-word into the preedit to be registered
scenario #5: insert a pasted text into preedit by uim-skk
1) Convert a text and fall into word-registering mode
2) Look up the kanji-word of 1) by a dictionary application
3) Select the kanji-word 2)
4) Re-select the textarea 1)
5) Paste the kanji-word by mouse
6) The bridge filters the paste event
7) uim_input_string(uc, "the kanji-word")
8) (input-string-handler id "the kanji-word")
9) Yank the kanji-word into the preedit to be registered
------------------------------------------------
YAMAMOTO Kengo / YamaKen yamaken at bp.iij4u.or.jp
FAMILY Given / Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uim-trunk-r3906-text-acquisition-api-20061007.diff
Type: application/octet-stream
Size: 13494 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/uim/attachments/20061007/52d31511/attachment.obj
More information about the uim
mailing list