summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-01-02 19:32:32 +0100
committermathieui <mathieui@mathieui.net>2013-01-02 19:32:32 +0100
commitea1851e00d4814b1de3eb992e53848fb17f9f473 (patch)
tree8a45021a484fb9f0020c88bfbb1efd41cc6fd7e6
parentd0a8304e5584ac925c858510a4005c4d5e9168cf (diff)
downloadpoezio-ea1851e00d4814b1de3eb992e53848fb17f9f473.tar.gz
poezio-ea1851e00d4814b1de3eb992e53848fb17f9f473.tar.bz2
poezio-ea1851e00d4814b1de3eb992e53848fb17f9f473.tar.xz
poezio-ea1851e00d4814b1de3eb992e53848fb17f9f473.zip
Iterate over the messages from the end, not from the start
(the corrected message is way more likely to be recent)
-rw-r--r--src/text_buffer.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/text_buffer.py b/src/text_buffer.py
index f1c4eb24..85ccd011 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -77,7 +77,8 @@ class TextBuffer(object):
return ret_val or 1
def modify_message(self, txt, old_id, new_id, highlight=False, time=None):
- for i, msg in enumerate(self.messages):
+ for i in range(len(self.messages) -1, -1, -1):
+ msg = self.messages[i]
if msg.identifier == old_id:
message = self.make_message(txt, time if time else msg.time, msg.nickname, msg.nick_color, None, msg.user, new_id, highlight=highlight, old_message=msg, revisions=msg.revisions + 1)
self.messages[i] = message