diff --git a/command_prompt.py b/command_prompt.py index 6d0492e..65e42f0 100644 --- a/command_prompt.py +++ b/command_prompt.py @@ -15,9 +15,11 @@ class Command_prompt(Label): # insert mode self.insert=False + # width of a letter + self.char_width=9 + # cursor position self.cursor=0 - self.cursor_width=9 # the text, with no color information self.raw_text="" @@ -41,7 +43,7 @@ class Command_prompt(Label): Rectangle(pos=self.pos,size=self.size) # cursor Color(1,1,1) - Rectangle(pos=(self.pos[0]+self.cursor*self.cursor_width,self.pos[1]),size=(self.cursor_width,self.height)) + Rectangle(pos=(self.pos[0]+self.cursor*self.char_width,self.pos[1]),size=(self.char_width,self.height)) # make text under cursor black if self.cursor: diff --git a/status_bar.py b/status_bar.py index 57c9409..1739bf6 100644 --- a/status_bar.py +++ b/status_bar.py @@ -8,8 +8,22 @@ class Status_bar(Label): # app is used to share information between widgets self.app=app + # width of a character + self.char_width=9 + + # unformatted text + self.raw_text="" + # init Label super(Status_bar,self).__init__(**kwargs) - def set_position(self,string): - self.text=escape_markup(string) + def set_text(self,string): + self.raw_text=string + self.draw() + + def draw(self): + # do not wrap + if len(self.raw_text)