Skip to content

Commit

Permalink
Fix for selection position after focus & clear selection
Browse files Browse the repository at this point in the history
  • Loading branch information
robmcmullen committed Dec 27, 2015
1 parent 54a7ee5 commit 8510134
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions omnivore/framework/minibuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"""
Expand Down

0 comments on commit 8510134

Please sign in to comment.