summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-17 03:34:04 +0200
committermathieui <mathieui@mathieui.net>2012-05-17 03:34:04 +0200
commit4c0a3fb5a2eca27133e558fa8394b3d07d0203ba (patch)
treec696614fa20404601c3d7d46a6bd5275cc223a99 /src/windows.py
parent0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9 (diff)
downloadpoezio-4c0a3fb5a2eca27133e558fa8394b3d07d0203ba.tar.gz
poezio-4c0a3fb5a2eca27133e558fa8394b3d07d0203ba.tar.bz2
poezio-4c0a3fb5a2eca27133e558fa8394b3d07d0203ba.tar.xz
poezio-4c0a3fb5a2eca27133e558fa8394b3d07d0203ba.zip
Resolves separator persistence problems - Fixes #2073
Now we have to pass the textbuffer object when we want to add a line separator.
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/windows.py b/src/windows.py
index ae79fb74..ea2cb3f7 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -620,11 +620,17 @@ class TextWin(Win):
self.pos = 0
self.built_lines = [] # Each new message is built and kept here.
# on resize, we rebuild all the messages
+
self.lock = False
self.lock_buffer = []
+
+ # the Lines of the highlights in that buffer
self.highlights = []
+ # the current HL position in that list
self.hl_pos = -1
+ self.separator_after = None
+
def toggle_lock(self):
if self.lock:
self.release_lock()
@@ -738,13 +744,18 @@ class TextWin(Win):
log.debug('remove_line_separator')
if None in self.built_lines:
self.built_lines.remove(None)
+ self.separator_after = None
- def add_line_separator(self):
+ def add_line_separator(self, room=None):
"""
add a line separator at the end of messages list
+ room is a textbuffer that is needed to get the previous message
+ (in case of resize)
"""
if None not in self.built_lines:
self.built_lines.append(None)
+ if room:
+ self.separator_after = room.messages[-1]
def build_new_message(self, message, history=None, clean=True, highlight=False):
"""
@@ -862,6 +873,8 @@ class TextWin(Win):
self.built_lines = []
for message in room.messages:
self.build_new_message(message, clean=False)
+ if self.separator_after is message:
+ self.build_new_message(None)
while len(self.built_lines) > self.lines_nb_limit:
self.built_lines.pop(0)