diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-02-15 20:55:31 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-02-15 20:55:31 +0100 |
commit | d184c555803b564148d8391b7a433acf891a8c87 (patch) | |
tree | 9fdd2a6aaecbb0c1442483bc037a8817eedd570f /src | |
parent | adf5a977a970fff1e3b42655ade0c3f61c3a8958 (diff) | |
download | poezio-d184c555803b564148d8391b7a433acf891a8c87.tar.gz poezio-d184c555803b564148d8391b7a433acf891a8c87.tar.bz2 poezio-d184c555803b564148d8391b7a433acf891a8c87.tar.xz poezio-d184c555803b564148d8391b7a433acf891a8c87.zip |
^J now inserts a line break in the input.
It is now possible to send multi-lines messages
Diffstat (limited to 'src')
-rw-r--r-- | src/windows.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/windows.py b/src/windows.py index 45a6d22b..fa17d8ff 100644 --- a/src/windows.py +++ b/src/windows.py @@ -717,6 +717,7 @@ class Input(Win): "M-[1;5C": self.jump_word_right, "KEY_BACKSPACE": self.key_backspace, '^?': self.key_backspace, + '^J': self.add_line_break, } Win.__init__(self) self.text = '' @@ -1008,6 +1009,12 @@ class Input(Win): self.on_input(self.get_text()) return True + def add_line_break(self): + """ + Add a (real) \n to the line + """ + self.do_command('\n') + def get_text(self): """ Clear the input and return the text entered so far @@ -1019,10 +1026,11 @@ class Input(Win): Refresh the line onscreen, from the pos and pos_line """ with g_lock: + text = self.text.replace('\n', '|') self._win.erase() if self.color: self._win.attron(common.curses_color_pair(self.color)) - self.addstr(self.text[self.line_pos:self.line_pos+self.width-1]) + self.addstr(text[self.line_pos:self.line_pos+self.width-1]) if self.color: (y, x) = self._win.getyx() size = self.width-x |