diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-07-12 23:31:23 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-07-12 23:31:23 +0000 |
commit | fe40220fe9cdda10545a65148f86c22d65e881a8 (patch) | |
tree | de7e9e39427f2f3d296eadefb13ff4109ddbba19 | |
parent | 8941ddf02011e96d10a3f7a74a50d1feedead8ba (diff) | |
download | poezio-fe40220fe9cdda10545a65148f86c22d65e881a8.tar.gz poezio-fe40220fe9cdda10545a65148f86c22d65e881a8.tar.bz2 poezio-fe40220fe9cdda10545a65148f86c22d65e881a8.tar.xz poezio-fe40220fe9cdda10545a65148f86c22d65e881a8.zip |
fix crash on ctrl+y with utf-8 in clipboard, also fixed #1528
-rw-r--r-- | src/window.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/window.py b/src/window.py index 8931ccac..cf4d540e 100644 --- a/src/window.py +++ b/src/window.py @@ -248,6 +248,7 @@ class TextWin(Win): if txt.startswith('\n'): txt = txt[1:] first = False + return lines return lines[-len(messages):] # return only the needed number of lines def refresh(self, room): @@ -258,11 +259,15 @@ class TextWin(Win): if not self.visible: return self.win.erase() + # if room.pos != 0: + # messages = room.messages[-self.height - room.pos : -room.pos] + # else: + # messages = room.messages[-self.height:] + lines = self.build_lines_from_messages(room.messages) if room.pos != 0: - messages = room.messages[-self.height - room.pos : -room.pos] + lines = messages[-self.height-room.pos:-room.pos] else: - messages = room.messages[-self.height:] - lines = self.build_lines_from_messages(messages) + lines = lines[-self.height:] y = 0 for line in lines: self.win.move(y, 0) @@ -410,7 +415,9 @@ class Input(Win): if not self.clipboard or len(self.clipboard) == 0: return for letter in self.clipboard: - self.do_command(letter) + from common import debug + debug("%s\n" % letter.encode('utf-8')) + self.do_command(letter.encode('utf-8')) # self.do_command(self.clipboard[-1]) def key_dc(self): |