commans: Fix the page up command on an empty buffer.
This commit is contained in:
parent
64712a9e74
commit
ba943ec58f
3 changed files with 10 additions and 6 deletions
3
main.py
3
main.py
|
@ -586,8 +586,7 @@ def buffer_switch_cb(_, _signal, buffer_ptr):
|
|||
if room_buffer.first_view and room_buffer.weechat_buffer.num_lines < 10:
|
||||
# TODO we may want to fetch 10 - num_lines messages here for
|
||||
# consistency reasons.
|
||||
if server.room_get_messages(room_buffer.room.room_id):
|
||||
room_buffer.first_view = True
|
||||
server.room_get_messages(room_buffer.room.room_id):
|
||||
|
||||
break
|
||||
|
||||
|
|
|
@ -1053,7 +1053,9 @@ def matrix_command_pgup_cb(data, buffer, command):
|
|||
W.window_get_integer(window, "first_line_displayed")
|
||||
)
|
||||
|
||||
if first_line_displayed:
|
||||
room_buffer = server.find_room_from_ptr(buffer)
|
||||
|
||||
if first_line_displayed or room_buffer.weechat_buffer.num_lines == 0:
|
||||
room_id = key_from_value(server.buffers, buffer)
|
||||
server.room_get_messages(room_id)
|
||||
|
||||
|
|
|
@ -907,16 +907,16 @@ class MatrixServer(object):
|
|||
|
||||
def room_get_messages(self, room_id):
|
||||
if not self.connected or not self.client.logged_in:
|
||||
return
|
||||
return False
|
||||
|
||||
room_buffer = self.find_room_from_id(room_id)
|
||||
|
||||
# We're already fetching old messages
|
||||
if room_buffer.backlog_pending:
|
||||
return
|
||||
return False
|
||||
|
||||
if not room_buffer.prev_batch:
|
||||
return
|
||||
return False
|
||||
|
||||
uuid, request = self.client.room_messages(
|
||||
room_id,
|
||||
|
@ -927,6 +927,8 @@ class MatrixServer(object):
|
|||
self.backlog_queue[uuid] = room_id
|
||||
self.send_or_queue(request)
|
||||
|
||||
return True
|
||||
|
||||
def room_send_read_marker(self, room_id, event_id):
|
||||
"""Send read markers for the provided room.
|
||||
|
||||
|
@ -1248,6 +1250,7 @@ class MatrixServer(object):
|
|||
def handle_backlog_response(self, response):
|
||||
room_id = self.backlog_queue.pop(response.uuid)
|
||||
room_buffer = self.find_room_from_id(room_id)
|
||||
room_buffer.first_view = False
|
||||
|
||||
room_buffer.handle_backlog(response)
|
||||
|
||||
|
|
Loading…
Reference in a new issue