Re: GtkText Insertion Behavior




Jay Bloodworth <jay@pathways.sde.state.sc.us> writes:

> This is either a bug report or a request for someone to explain why the
> current behavior is correct.  Take your pick.
> 
> Single clicks in a GtkText box move the cursor as expected.  However, they
> don't move the insertion point.  You don't notice this behavior with
> simple editing in the widget because the keypress handler updates the
> insertion point to match the cursor mark.  However, if the cursor is moved
> and then text is inserted by a direct call to gtk_text_insert, the
> insertion occurs at the old insertion point.

I'm not sure it is a bug. There is no guarantee that the point will
ever correspond to the cursor position; it might make sense to
move the point to the cursor whenever the cursor is moved, but
that might also just introduce more subtle bugs in peoples code
if they begin assuming the correspondance.

Settting the point to the cursor position is quite easy (much easier
than the reverse, currently)

 gtk_text_set_point (GTK_TEXT (text), GTK_EDITABLE (text)->cursor_position);
 
> As a generalization of the above issue, what is the point of having the
> cursor location and the insertion point be distinct anyway?

The biggest reason is that the cursor must always be on screen.
So if you want to insert text offscreen, having the independent
point is a definite feature.

The correspondence between the two could certainly be more well
documented, and perhaps made to act a bit more sensibly.

Regards,
                                        Owen
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]