Fix focusSearchEntry - select_region is completely broken, even with ctypes -

for a fix, just override the default 'select-all' by positioning the cursor at the
end of any existing text, which is most likely what we want anyhow
This commit is contained in:
Michael Webster 2013-03-13 20:13:56 -04:00
parent 1681b718ee
commit 5f029342ed

View File

@ -577,12 +577,11 @@ class pluginclass( object ):
self.buildButtonList()
def focusSearchEntry( self ):
# grab_focus() does select all text, as this is an unwanted behaviour we restore the old selection
sel = self.searchEntry.get_selection_bounds()
if len(sel) == 0: # no selection
sel = ( self.searchEntry.get_position(), self.searchEntry.get_position() )
# grab_focus() does select all text,
# restoring the original selection is somehow broken, so just select the end
# of the existing text, that's the most likely candidate anyhow
self.searchEntry.grab_focus()
self.searchEntry.select_region( sel[0], sel[1] )
gtk.gtk_editable_set_position(hash(self.searchEntry), -1)
def buildButtonList( self ):
if self.buildingButtonList: