[Uim] surrounding text

Etsushi Kato ek.kato at gmail.com
Wed Oct 11 08:46:43 EEST 2006


I've added specific handling with widgets which use/inherit GtkEntry
and GtkTextView.  See details below.

On 10/10/06, YAMAMOTO Kengo / YamaKen <yamaken at bp.iij4u.or.jp> wrote:
> At Tue, 10 Oct 2006 14:31:01 +0900,
> ek.kato at gmail.com wrote:
> >
> > On 10/10/06, YAMAMOTO Kengo / YamaKen <yamaken at bp.iij4u.or.jp> wrote:
> > > At Tue, 10 Oct 2006 03:37:20 +0900,
> > > ek.kato at gmail.com wrote:
> > > >
> > > > Here is the details and problems.
> > >
> > > > 2) For text acquisition in UTextArea_Selection and
> > > > UTextArea_Clipboard, I made it fails upon UTextOrigin_Cursor origin
> > > > since its meaning is unclear for me.  For the text extent, it support
> > > > non-negative numbers and UTextExtent_Full.  Since the meaning of
> > > > UTextExtent_Line in this case is unclear for me, I just assume it as
> > > > UTextExtent_Full.
> > >
> > > As written as follows along with enum UTextArea, the cursor of
> > > UTextArea_Clipboard must always be positioned at end of the text
> > > virtually.

OK.  Now UTextOrigin_End is only supported in the acquisition of
UTextArea_Clipboard.

> > I see.  But how about selection?  Is it also applicable to it?
>
> It is positioned at end or beginning of the text in accordance
> with the dragged direction. acquire_cb should reflect it. But if
> it is not detectable, end of the text is appropriate fallback
> for the cursor position.

For GtkEntry and GtkTextView, I've implemented to check whether the
origin is beginning or end when user specifies UTextOrigin_Cursor.
For the rest of widget, it assume the origin is end.  Of course,
UTextOrigin_Beginning and UTextOrigin_End are treated appropriately in
any widget.

> > And how do I treat UTextExtent_Line in selection/clipboard?
>
> Oops. I forgot to reply to it.
>
> Suppose the clipboard is having this string.
>
>   "first line.\nsecond LINE.\nthird LiNe."
>
> In this case,
>   (UTextOrigin_End, UTextExtent_Line) returns "third LiNe."
>   (UTextOrigin_Beginning, UTextExtent_Line) returns "first line."
>
> And one another.
>
>   "\nfirst line.\nsecond LINE.\nthird LiNe.\n"
>
>   (UTextOrigin_End, UTextExtent_Line) returns ""
>   (UTextOrigin_Beginning, UTextExtent_Line) returns ""

OK.  Now it is supported (presumably).

> > > > 2') In GTK+'s clipboard on X11, a text acquired with
> > > > GDK_SELECTION_PRIMARY with UTextArea_Selection doesn't mean it is the
> > > > text on the target application.  I think this may cause some problems.
> > > >  Possibly some other way to get a selected text on a widget may exist,
> > > > but I'm not sure.
> > >
> > > > 3'') For deletion in UTextArea_Selection, I just set the function
> > > > delete_selection_text() empty and return success since I'm not sure
> > > > how to delete selection text in GTK+, and I think it will be replaced
> > > > newly committed text in the scenario #3.
> > >
> > > Hmm... is it impossible to trick GTK+ to find the widget which
> > > is associated with the input context? GtkEditable has the
> > > features for our need.
> >
> > Yes.  Our GTK+ bridge knows its widget of the context.  I'll
> > investigate more later about this.  But we can't assume all the widget
> > of the input context support GtkEditable, I think.
>
> I see. I'll relax the specification once your investigation (and
> implementation) has been finished.

I've added GtkEntry and GtkTextView specific handling for deletion
of UTextArea_Selection.  For these widget, now we can guarantee that
the selected text is on the application.

And for the deletion of text in UTextAreaPrimary, UTextExtent_Full and
UTextExtent_Line are now supported in these widgets.

For the acquisition of UTextAreaPrimary with GtkTextView, now we can
get whole text (multiple lines) with UTextExtent_Full.


The problems for the input context on a custom widget which doesn't
use/inherit GtkEntry or GtkTextView is still remained.  But it can't
be helped for now.

 * Maybe these widget don't support get_surrounding and/or
   delete_surrounding.
 * Even if it supports delete_surrounding, we can't use
   UTextExtent_Full and/or UTextExtent_Line.
 * A text acquired with UTextArea_Selection doesn't mean it is on the
   target application.
 * How to delete the selected text?  We just expect it will be
   replaced with newly committed text.

Cheers,
-- 
Etsushi Kato
ek.kato at gmail.com



More information about the uim mailing list