# HG changeset patch # User souliane # Date 1401838031 -7200 # Node ID b62c1cf0dbf76d3d9d840fa8f4adec697f29d481 # Parent 07433bd892ee0b853cfd720ed80bbd6ec5f4f37a browser side: a new message being edited should always stay on top position (or last position for a comment) diff -r 07433bd892ee -r b62c1cf0dbf7 src/browser/panels.py --- a/src/browser/panels.py Wed Jun 04 00:23:14 2014 +0200 +++ b/src/browser/panels.py Wed Jun 04 01:27:11 2014 +0200 @@ -834,6 +834,7 @@ @param vpanel: VerticalPanel instance @param entry: MicroblogEntry @param reverse: more recent entry on top if True, chronological order else""" + assert(isinstance(reverse, bool)) if entry.empty: entry.published = time() # we look for the right index to insert our entry: @@ -845,12 +846,9 @@ if not isinstance(child, MicroblogEntry): idx += 1 continue - if reverse: - if child.published < entry.published: - break - else: - if child.published > entry.published: - break + condition_to_stop = child.empty or (child.published > entry.published) + if condition_to_stop != reverse: # != is XOR + break idx += 1 vpanel.insert(entry, idx)