* src/AutoComp.py (AutoCombo.timer_callback): Fix autocompletion

so that the typed portion of the text is always visible.


svn: r1749
This commit is contained in:
Alex Roitman 2003-06-15 05:31:36 +00:00
parent 6966e9f0fd
commit e6e150b63f
2 changed files with 8 additions and 3 deletions

View File

@ -16,6 +16,8 @@
into C-locale string (for saving floats in XML) into C-locale string (for saving floats in XML)
* src/StyleEditor.py (draw): Call locale.str instead of str. * src/StyleEditor.py (draw): Call locale.str instead of str.
* src/TextDoc.py (StyleSheetList.save): Call gformat instead of '%f'. * src/TextDoc.py (StyleSheetList.save): Call gformat instead of '%f'.
* src/AutoComp.py (AutoCombo.timer_callback): Fix autocompletion
so that the typed portion of the text is always visible.
2003-06-14 Don Allingham <dallingham@users.sourceforge.net> 2003-06-14 Don Allingham <dallingham@users.sourceforge.net>
* src/preferences.glade: Don't immediately show preferences dialog * src/preferences.glade: Don't immediately show preferences dialog

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002 Donald N. Allingham # Copyright (C) 2002-2003 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -222,8 +222,11 @@ class AutoCombo(AutoCompBase):
n = self.vals[0] n = self.vals[0]
self.nl = string.lower(n) self.nl = string.lower(n)
entry.set_text(n) entry.set_text(n)
gtk.Editable.set_position(entry,self.l) # Select non-matching text from the end to the beginning:
gtk.Editable.select_region(entry,self.l, -1) # this preserves the visibility of the portion being typed.
ln = len(n)
gtk.Editable.set_position(entry,ln-1)
gtk.Editable.select_region(entry,ln,self.l)
else: else:
self.vals = [""] self.vals = [""]