From 8510134b33d24e157d5d0849e0a73d563f6c0726 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Sat, 26 Dec 2015 22:26:01 -0800 Subject: [PATCH] Fix for selection position after focus & clear selection --- omnivore/framework/minibuffer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/omnivore/framework/minibuffer.py b/omnivore/framework/minibuffer.py index e1afcead..aca2ebc5 100644 --- a/omnivore/framework/minibuffer.py +++ b/omnivore/framework/minibuffer.py @@ -101,7 +101,9 @@ def focus(self): the text focus. """ log.debug("TextCtrl focus!!!") + s1, s2 = self.text.GetSelection() self.text.SetFocus() + self.text.SetSelection(s1, s2) def on_text(self, evt): text = evt.GetString() @@ -139,8 +141,15 @@ def get_result(self, show_error=True): return text, error def clear_selection(self): + # When text is selected, the insertion point is set to start of + # selection. Want to set it to the end of selection so the user can + # continue typing after deselected. p = self.text.GetInsertionPoint() + s1, s2 = self.text.GetSelection() + if s1 != s2: + p = s2 self.text.SetSelection(p, p) + self.text.SetInsertionPoint(p) def perform(self): """Execute the command associatied with this minibuffer"""