Bug 453112 - Fixed scroll position jumps around during non-visible output
Summary: Fixed scroll position jumps around during non-visible output
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: history (show other bugs)
Version: 22.04.0
Platform: Gentoo Packages Linux
: NOR major
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-28 03:48 UTC by Luke-Jr
Modified: 2022-06-01 22:26 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2022-04-28 03:48:33 UTC
SUMMARY
The scroll position is no longer fixed as it ought to be.

STEPS TO REPRODUCE
1. Set a Fixed size buffer (eg, 1000 lines as default)
2. while sleep 1; do date; done
3. Scroll up so new output isn't visible (eg, Shift-Up to go up one line)

OBSERVED RESULT
Scroll position constantly changes as there's new output beyond the visible area

EXPECTED RESULT
Scroll position remains fixed and window contents unchanging

ADDITIONAL INFORMATION

Regression since 21.12.3 (I think)

Unlimited buffer doesn't have the problem, it appears
Comment 1 Ahmad Samir 2022-05-03 09:43:51 UTC
*** Bug 452955 has been marked as a duplicate of this bug. ***
Comment 3 Ahmad Samir 2022-05-03 10:41:12 UTC
From https://bugs.kde.org/show_bug.cgi?id=452955#c2:
I tested !645 and it didn't help. It might be a duplicate, from just looking at it, but something else is going on.
Comment 4 Michael 2022-05-03 10:45:30 UTC
Okay. Upon more careful examination, it turns out the !645 works if the output is spit out in separate lines, like `while true; do date; done`
However, the reason I thought it didn't work, is because I was testing it with `cat /dev/urandom | base64`, which spits out one long noodle, and konsole I guess is linewrapping (?), and in that case the !645 doesn't work.
Comment 5 ninjalj 2022-05-24 11:11:11 UTC
Git commit d2ca202abd4e6b415a7647927db493337092d5f3 by Luis Javier Merino Morán.
Committed on 24/05/2022 at 10:51.
Pushed by tcanabrava into branch 'master'.

Fix scroll position jumps regression

Commit d37d3ac1 "CompactHistoryScroll: Remove _maxLineCount + 5 lines at
a time" caused a regression: addHistLine queried the number of lines in
history before and after adding a line, and if it had not incremented it
assumed one line entered history and another was dropped at the other
end.  Now, lines are dropped from history in batches, so take care of
that.

Very similar to the regression fixed at 7a1e4768, only this one is about
keeping the scroll position on the presence of scroll, and that other
one is about keeping the selection.

Thanks to the bug reporters Michael and Luke-Jr for the heads-up.
Related: bug 452955

M  +6    -4    src/Screen.cpp

https://invent.kde.org/utilities/konsole/commit/d2ca202abd4e6b415a7647927db493337092d5f3
Comment 6 Luke-Jr 2022-05-24 18:49:47 UTC
(In reply to ninjalj from comment #5)
> Git commit d2ca202abd4e6b415a7647927db493337092d5f3 by Luis Javier Merino
> Morán.
> Committed on 24/05/2022 at 10:51.

Confirmed this seems to fix it (backported to 22.04.0)
Comment 7 ninjalj 2022-06-01 22:26:58 UTC
Git commit a6fce70f6c4e4d355c14475be8f5669a83c7023f by Luis Javier Merino Morán.
Committed on 01/06/2022 at 22:16.
Pushed by ahmadsamir into branch 'release/22.04'.

Fix scroll position jumps regression

Commit d37d3ac1 "CompactHistoryScroll: Remove _maxLineCount + 5 lines at
a time" caused a regression: addHistLine queried the number of lines in
history before and after adding a line, and if it had not incremented it
assumed one line entered history and another was dropped at the other
end.  Now, lines are dropped from history in batches, so take care of
that.

Very similar to the regression fixed at 7a1e4768, only this one is about
keeping the scroll position on the presence of scroll, and that other
one is about keeping the selection.

Thanks to the bug reporters Michael and Luke-Jr for the heads-up.
Related: bug 452955
(cherry picked from commit d2ca202abd4e6b415a7647927db493337092d5f3)

M  +4    -4    src/Screen.cpp

https://invent.kde.org/utilities/konsole/commit/a6fce70f6c4e4d355c14475be8f5669a83c7023f