Konsole scrollback buffer is missing sometimes

This is something that really bugs me sometimes, I can be using KDE and konsole for a while and really need to see a command that ran in the past but the right edge slider of the konsole can’t be moved. So basically it’s like the entire scroll buffer is just the amount I can view in the window now. If I then exit that tab and make a new tab and run some commands I have some buffer again. So the bug is like at some point in the life of a tab it just stops retaining history of the scrollback, deletes the whole thing and just shows what’s in the view now. The Konsole Settings-> Edit Current Profile-> Scrolling shows I have scrollback set to “Fixed” and “6000” lines so at the 6001’st line the line should fall off the end of the buffer in a windowed fashion but no matter how long the tab lives those 6000 lines should be visible by scrolling back the right edge bar with the mouse.

That’s generally not happening always with this bug, but for a while I can see buffering.
I’m on:

Operating System: Fedora Linux 42
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2

and konsole is from package konsole-24.12.3-1.fc42.x86_64

I then thought maybe konsole has a problem with going to a remote host with “ssh” and running command there and coming back. So as a test and ssh’ed to remote host ran some expensive commands that dump lots of text like “journalctl -b 0”, then came back and the buffer was still there.

UPDATE, another thing I did was to run some very verbose commands like “journalctl” and catting long text files and ‘dmesg’, then I saved the output to a text file with:
File → “Save output As…” to a file like “foo-kon.txt”, then I catted that to wc and found a count of lines that fluctuates around “6000” but not right there:

cat foo-kon.txt |wc
   5975   64641  486325

"journalclt |wc " itself shows as 140000 lines so that should have saturated my “6000” line limit. So I did another “journalctl” and got a saved output file “konsole.txt” (to use a different file this time) of 5003 lines:

cat konsole.txt |wc
     5003   64622  770682

So the buffer seems to save content in a chunky way (not exactly to 6000 lines but in that area). The last command I ran there was journalctl which spewed 140000 some lines so it should have completely filled the 6000 limit I set.

I think I’ve seen this, too.

What’s so annoying is it seems to happen after a long, unpredictable time with no apparent pattern

Did some application switch to the alternate screen and crash or something?

Next time it happens you can try:

tput rmcup

to go back to the normal screen.

tput smcup

switches to the alternate screen.

Did some application switch to the alternate screen and crash or something?

No, no screen switch or app crash. These scrollback disappearance happen pretty often and in normal situations otherwise

I have seen a different fluke, but likely related - e.g. and old buffer is printed over a part of a new one (e.g. from visible lines, half is old, half is new). Once you press Enter a couple of time or clear the terminal, it’s fine again.