Open reubeno opened 5 days ago
Can we test with a tty? For example spawn the shell with https://docs.rs/portable-pty/0.4.0/portable_pty/ it doesn't work(
@39555 -- I think the issue is going to be with any pty/tty where b"\x1B[6n"
isn't handled. Here's the code in question in crossterm
's read_position_raw()
:
Ideally it would be great if reedline
could provide a degraded experience when read_position*
fail. I don't know how feasible that is, though.
At worst, we could fallback to testing brush
with --input-backend=basic
, but the basic input backend (which doesn't use reedline
) doesn't support any standard readline behavior and doesn't support tab completion.
@reubeno what about using Alacritty to test interactive usage? Than it would be the same experience. Allacritty can be used as a library without a GUI, specifically alacritty_terminal
crate, there are Term
struct and tty::new
, it can open a pty and can process various events. I don't know will it work or not but we can try
I'm open to us pursuing creative ideas like the one you suggest--and I also still want to see us address the underlying limitation inherited from crossterm
/reedline
.
As a specific motivating example, I looked into whether we could run the bash-completion
project's pytest-based test suite. Thus far, bash-completion
has been pretty fantastic at finding compatibility bugs in brush
, and I think it would be great for us to target getting the suite fully passing. It's what caused me to file this issue, though; those tests rely on pexpect
and fail out extremely early on brush
due to this problem. I'd wager there could be other existing OSS projects with similar tests that could be useful to leverage, but which fall into the same category.
(As an aside, we already are using expectrl
for limited interactive tests in this project, but we had to select the basic
input backend for the reasons described above.)
This looks to be the same as https://github.com/nushell/reedline/issues/594.
Looks like
reedline
calls intocrossterm
to query the current cursor position;crossterm
, in turn, implements that by sending a VT terminal code and waiting a limited period of time for the terminal emulator to detect the code and respond with encoded cursor info. When the duration elapses without a response, as happens withpexpect
and other simple terminal "hosts", an error percolates up and brush is unable to proceed.brush
can be run with thebasic
input backend, but then features like tab completion can't be tested in those environments. Would be great to figure out how to make this work for testing purposes (e.g., to run bash-completion integration test suite).