[Sugar-devel] [PATCH sugar-toolkit] Cursor moves to beginning while trying to edit activity instance name #2608
Sascha Silbe
sascha-ml-reply-to-2011-2 at silbe.org
Tue Feb 15 15:00:27 EST 2011
Excerpts from Aleksey Lim's message of Mon Feb 14 23:23:25 +0100 2011:
> def __jobject_updated_cb(self, jobject):
> + prev_pos = self.entry.props.cursor_position
> self.entry.set_text(jobject['title'])
> + self.entry.set_position(prev_pos)
The GTK documentation doesn't say anything about what the cursor position
will be after a set_text() call, so we need to take care of saving and
restoring the cursor position (i.e. your patch does the right thing).
But the documentation for set_position() says the position must not
exceed the number of characters currently in the widget, so we need some
bounds checking here (the title might have been shortened).
Sascha
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110215/c3897e78/attachment.pgp>
More information about the Sugar-devel
mailing list