-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the cause of test_yamatanooroti randomly failing #474
Conversation
I think cooked mode is making backspace ignored (not sent to remote server), and this pull request might improve it. |
@tompng |
@hasumikin # jumping cursors
Reline::LineEditor.prepend Module.new{
def render_dialog(...); sleep 0.2; super(...); end
} # remaining strings
class Reline::LineEditor::Dialog
def contents;sleep 0.005;@contents;end
end |
f8b184f
to
a797eaa
Compare
I checked on macOS, and Linux is also Reline::ANSI, so I think it's ok. |
It works fine on Windows. |
(ruby/reline#474) * Add repeated input-delete test that fails on HEAD * Use raw mode while readmultiline
(ruby/reline#474) * Add repeated input-delete test that fails on HEAD * Use raw mode while readmultiline
When pressing tab key for a long time, cursor is moving right and left. On the right end, something(
nt
and----
) is remain displayed.This behavior is also causing random test failure in
rake test_yamatanooroti
.These tests failed in my local environment (macOS, Terminal.app, vterm 0.2, looks like fails more frequently compared to ci)
I ran
test_update_cursor_correctly_when_just_cursor_moving
, the most frequently failing test in local for 100 times(local) and 50 times(ci in forked repository: tompng@da6b2c5, job result: https://github.com/tompng/reline/actions/runs/3307143383/jobs/5458548780)Failing result sometimes contains
^B
and^N
.This is because getc in ansi.rb is using
STDIN.raw{getc}
, that means there is a non-raw time between the next getc.When there is new input while rendering a dialog, prompt or something else, the input is echo-ed.
To fix this, reline should not echo while editing multiline.
Changes
I added
Reline::IOGate.with_raw_input
and used inReline.readmultiline
.I used
IO#raw
, notIO#noecho
. noecho will show a key mark cursor for password input in Terminal.app and iTerm2 and maybe other teminals.In raw mode,
\n
will only move cursor down, not left-end of the next line andtest_terminate_in_the_middle_of_lines
will fail. So I added\r
to methodrerender
inline_editor.rb
Added test writing
a[delete]a[delete]a[delete]...(4000 times)
to vterm.In HEAD, it fails with
failed result: https://github.com/tompng/reline/actions/runs/3307571761/jobs/5459304761