Module: deluge Branch: master Commit: cd7805bfda2f67e7fd9bd9cd4dd55b8d3d8254ad
Author: Nick <[email protected]> Date: Tue Feb 8 14:43:41 2011 +0100 make text input not go over width --- deluge/ui/console/modes/input_popup.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/modes/input_popup.py b/deluge/ui/console/modes/input_popup.py index da6139b..72b9991 100644 --- a/deluge/ui/console/modes/input_popup.py +++ b/deluge/ui/console/modes/input_popup.py @@ -109,9 +109,17 @@ class TextInput(InputField): if selected: if self.opts: self.parent.add_string(row+2,self.opts[self.opt_off:],screen,1,False,True) - self.move_func(row+1,self.cursor+1) + if self.cursor > (width-3): + self.move_func(row+1,width-2) + else: + self.move_func(row+1,self.cursor+1) self.parent.add_string(row,self.message,screen,1,False,True) - self.parent.add_string(row+1,"{!black,white,bold!}%s"%self.value.ljust(width-2),screen,1,False,False) + slen = len(self.value)+3 + if slen > width: + vstr = self.value[(slen-width):] + else: + vstr = self.value.ljust(width-2) + self.parent.add_string(row+1,"{!black,white,bold!}%s"%vstr,screen,1,False,False) return 3 -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
