Re: gtk_text_get_point() == cursor position?




Matthias Moeller <mattes@ice.robin.de> writes:

> Hello
> 
> I found a problem with the method gtk_text_get_point() of
> GtkTextWidget. It seems that the method reports the wrong 
> cursor position after moving the cursor around with the 
> cursor-keys.
> 
> After inserting characters, the reported position is ok.
> This is because the method gtk_text_insert() calls the 
> internal function advance_mark_n(&text->point, length)
> which updates the point position.
> 
>  On the other hand, the internal function move_cursor_ver()
> (which is called after cursor-key press) only updates 
> text->cursor_mark, but not text->point. text->point then
> later gets updated before the next key press is evaluated
> in gtk_text_key_press().

The point is merely the place where text is inserted. It
has no connection to the cursor (except that occasionally
the point is moved to the cursor position)

You can get the current position with:

 GTK_EDITABLE (text)->current_pos.

> I don't fully understand the code and especially the 
> difference between the two GtkPropertyMarks "point" and
> "cursor_mark".
> 
> Maybe somebody could explain whether I found a bug or a
> feature ;-) Thanks in advance,

It's a feature. But it most likely won't be a feature of the 
next generation of text widget. ;-)

Regards,
                                        Owen



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