diff --git a/command_prompt.py b/command_prompt.py index 65e42f0..3cbe64f 100644 --- a/command_prompt.py +++ b/command_prompt.py @@ -27,6 +27,9 @@ class Command_prompt(Label): # array of command with arguments self.argv=[] + # display characters from window_offset onwards (for text wrapping) + self.window_offset=0 + # init Label super(Command_prompt,self).__init__(**kwargs) @@ -37,19 +40,31 @@ class Command_prompt(Label): def draw(self): + # wrap text + window_size=int(self.width/self.char_width) + if self.cursor>=self.window_offset+window_size: + self.window_offset=self.cursor-window_size+1 + elif self.cursor