cdberkstresser/fah-control

Logs don't scroll to the bottom at startup or when updated

Closed this issue · 6 comments

At startup, logs are not scrolled to the bottom when "follow" is selected (best to have all slots paused to reproduce). Same thing if you update them

I've been debugging this for a couple of days already, and I cannot find the culprit.
By monitoring signals mark-set and mark-deleted emitted by GtkTextBuffer, I know that the python code is doing the right thing, however "something else" is setting another mark to a different value and that value is used by GtkTextView instead

on_log_buffer_mark_set end 9578 0
on_log_buffer_mark_set None 9578 0
on_log_buffer_mark_set None 5194 67
on_log_buffer_mark_set None 5194 67

This is what I get when I refresh the logs: 9578 is the correct end of the logs, and end is the name of the mark set in ClientConfig.scroll_log_to_end. However there are this unnamed marks that get set as well, and the text view scrolls to the (wrong) value of 5194 instead

On line 350 of Client.py, I tried adding:

self.config.scroll_log_to_end(app)

Is that the behavior we would want out of the "follow" option. It seems fairly aggressive, but it does stay at the bottom.
Context:

 def update(self, app):
        prevStatus = self.get_status()
        self.config.scroll_log_to_end(app)
        try:
            self.conn.update()
            ...

Eventually logs are followed, without that patch. The problem occurs at startup (and it's easier to see if you unchecked "follow" before restarting fahcontrol), and when you "update" the logs. Does that patch work in those two cases too?

Tried and I can tell your patch fixes the issue. However when updating the logs, it goes back and forth for a few seconds
logs

Ah, just found out that it makes it impossible to scroll up: logs will immediately scroll down

It's pretty aggressive at scrolling down. I can't see that same effect on my screen with it undoing the progress.
Thinking about the "follow" button, I'm starting to wonder if that behavior is really implementable in a universally suitable manner?
Would we be better off with either
A) just inverting the log to show newest information at the top or
B) changing the "Follow" checkbox to a "Go to Bottom" button that could be clicked at will
???

ipkh commented

It works for me, it loads the log at the top to start. It jumps to the end when the next entry is made in the log and follows from there on.