diff options
-rw-r--r-- | poezio/mam.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/poezio/mam.py b/poezio/mam.py index c42e7a18..ad1c07e2 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -191,6 +191,7 @@ async def fetch_history(tab, end: Optional[datetime] = None, amount: Optional[in async def on_tab_open(tab) -> None: amount = 2 * tab.text_win.height end = datetime.now() + tab.query_status = True for message in tab._text_buffer.messages: time = message.time if time < end: @@ -199,6 +200,7 @@ async def on_tab_open(tab) -> None: try: await fetch_history(tab, end=end, amount=amount) except (NoMAMSupportException, MAMQueryException, DiscoInfoException): + tab.query_status = False return None @@ -210,6 +212,10 @@ async def on_scroll_up(tab) -> None: # join if not already available. total, pos, height = len(tw.built_lines), tw.pos, tw.height rest = (total - pos) // height + # Not resetting the state of query_status here, it is changed only after the + # query is complete (in fetch_history) + # This is done to stop message repetition, eg: if the user presses PageUp continuously. + tab.query_status = True if rest > 1: return None |