Ensure jobs log viewer stay at bottom when appending

This commit is contained in:
Kovid Goyal 2022-01-05 09:39:32 +05:30
parent d428e01d2a
commit a67fcb81f1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -489,7 +489,11 @@ class DetailView(Dialog): # {{{
more = f.read() more = f.read()
self.next_pos = f.tell() self.next_pos = f.tell()
if more: if more:
v = self.log.verticalScrollBar()
atbottom = v.value() >= v.maximum() - 1
self.log.appendPlainText(more.decode('utf-8', 'replace')) self.log.appendPlainText(more.decode('utf-8', 'replace'))
if atbottom:
v.setValue(v.maximum())
# }}} # }}}