On 02/14/2011 05:23 PM, Aleksey Lim wrote:
This issue is not the same as #1948 but #1948 triggers this one.
In some cases set_text doesn't change cursor position but not in all cases.
---
  src/sugar/activity/widgets.py |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index a8664d9..8d34855 100644
--- a/src/sugar/activity/widgets.py
+++ b/src/sugar/activity/widgets.py
@@ -201,7 +201,9 @@ class TitleEntry(gtk.ToolItem):
          self.entry.modify_bg(state, color)

      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)

      def __title_changed_cb(self, entry, activity):
          if self._update_title_sid is not None:

Hi Aleksey,

thanks for your patch. From a working point of view your patch does mostly get it right. Though it can squash by one character in some circumstances since there is still the race between the parties involved (update of entry, the gobject.timeout and the jobject_update), reproducible when you type a longer title and do a bit of pausing etc.

I will have another look if I can come up with another patch.

Regards,
   Simon
   Simon
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to