Files
fish-shell/tests/pexpects/scrollback.py
Johannes Altmanninger b964072c11 Move scrollback-push feature detection to fish script
A lot of terminals support CSI Ps S.  Currently we only allow them
to use scrollback-up if they advertise it via XTGETTCAP.  This seems
surprising; it's better to make visible in fish script  whether this
is supposed to be working.  The canonical place is in "bind ctrl-l"
output.

The downside here is that we need to expose something that's rarely
useful. But the namespace pollution is not so bad, and this gives
users a nice paper trail instead of having to look in the source code.
2025-09-27 14:22:18 +02:00

23 lines
586 B
Python

#!/usr/bin/env python3
from pexpect_helper import SpawnedProc, control
import os
env = os.environ.copy()
env["TERM"] = "not-dumb"
sp = SpawnedProc(env=env, scroll_content_up_supported=True)
sendline, expect_prompt = sp.sendline, sp.expect_prompt
expect_prompt()
sendline("bind ctrl-g scrollback-push")
expect_prompt()
sp.send(control("g"))
sp.send_cursor_position_report(y=10, x=5)
sp.send_primary_device_attribute()
sp.expect_str("\x1b[9S\x1b[9A")
sp.send(control("l"))
sp.send_cursor_position_report(y=15, x=5)
sp.send_primary_device_attribute()
sp.expect_str("\x1b[14S\x1b[14A")