Bug 379318 - CSI S escape sequence (SU, scroll up) ignored if number of lines to scroll bigger than scrollable lines
Summary: CSI S escape sequence (SU, scroll up) ignored if number of lines to scroll bi...
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: 17.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 389746 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-28 16:58 UTC by Moritz Bunkus
Modified: 2018-03-05 16:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot showing the corrupted output (242.13 KB, image/png)
2017-04-28 16:58 UTC, Moritz Bunkus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Bunkus 2017-04-28 16:58:32 UTC
Created attachment 105242 [details]
screenshot showing the corrupted output

Running konsole → tmux v2.4 I noticed screen corruption whenever I output certain types of texts, e.g. the output of "certtool -i < some-cert.pem" which dumps an X509 certificate in text form including an ASCII pictogram. I've reported this to tmux[1] where you can see more details.

The tmux developers looked into it and were able to reproduce it with konsole, but neither with xterm nor with gnome-terminal. According to [2] this is a problem in konsole. What happens is that tmux sends a scroll up event with quite a number of lines, in fact more lines that konsole is currently displaying. In that case konsole ignores the whole scroll up command. Again according to [2] this is a bug in konsole.

How to reproduce:

• download this[3] test file (this is the aforementioned output of "certtool")
• start tmux v2.4 with its default configuration, e.g. "tmux -Ltest -f/dev/null"
• run "cat tmux-causes-bad-output.txt", maybe multiple times as the output isn't consistent over multiple iterations, and observe the broken behavior

The author of tmux has a simple test to show off the problem:

• Resize konsole so that fewer than ten but more than five lines are shown
• Type a bit of text so that there's something to scroll
• Enter "printf '\033#8\033[10;15r\033[10S'" and observe that the content isn't scrolled off properly (tries to scroll ten lines)
• Try "printf '\033#8\033[10;15r\033[5S'" instead and observe that the content is scrolled off properly (tries to scroll five lines)

[1] https://github.com/tmux/tmux/issues/893
[2] https://github.com/tmux/tmux/issues/893#issuecomment-298041424
[3] https://www.bunkus.org/misc/tmux-causes-bad-output.txt
Comment 1 Markus Trippelsdorf 2017-05-16 05:26:34 UTC
Patch: https://git.reviewboard.kde.org/r/130133/diff/1#index_header
Comment 2 Moritz Bunkus 2017-05-16 06:48:37 UTC
Thanks for the suggested patch. Please note that tmux has committed a patch[1] to limit the number of lines to scroll to the number of visible lines after my original bug report.

Therefore if you want to test the patch, you'll have to test it against tmux 2.4, not against tmux master.

I'll try to test your patch later today.

[1] https://github.com/tmux/tmux/commit/54e2205e545d72d8d9ccaadfd4d1212bafb2f41b
Comment 3 Moritz Bunkus 2017-05-16 08:56:34 UTC
Your patch seems to fix the issue for me with tmux 2.4 (default configuration). Thanks.
Comment 4 Kurt Hindenburg 2017-07-01 23:16:50 UTC
Git commit 7ff23512fd6c6af1dba87083446f85baf75e9c71 by Kurt Hindenburg.
Committed on 01/07/2017 at 23:12.
Pushed by hindenburg into branch 'master'.

Correct scrollUp behavior

CSI S escape sequence (SU, scroll up) ignored if number of lines to
scroll bigger than scrollable lines

REVIEW: 130133

M  +7    -2    src/Screen.cpp

https://commits.kde.org/konsole/7ff23512fd6c6af1dba87083446f85baf75e9c71
Comment 5 kdebugs 2018-03-05 16:36:34 UTC
*** Bug 389746 has been marked as a duplicate of this bug. ***