Skip to content
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

Always use alternate sceen on alt-d #988

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

tompng
Copy link
Member

@tompng tompng commented Aug 14, 2024

Fixes screen corruption when PAGER=more is used.

When ALT+D is pressed while showing document dialog, document in shown in full screen using pager.
IRB assumes that the pager switches to alternate screen, turns off alternate screen at exit, and restore IRB's screen.

Some pager like more does not do that. Screen corrupts. We need to switch to alternate screen manually.

irb_with_pager_eq_more
To reproduce:
PAGER=more irb (make sure more is not aliased to less)
PAGER="sh -c 'cat;sleep 1'" irb

@st0012 st0012 added the bug Something isn't working label Aug 14, 2024
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wrap this around IRB's pager implementation too?

begin
print "\e[?1049h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we want ri to do most of the time as well?

@tompng
Copy link
Member Author

tompng commented Oct 13, 2024

IRB's pager and in ri command, I think we don't need to use this escape sequence.
The situation that needs force enable alternate screen mode and restore screen only happens when called from show_doc_dialog_proc.

@tompng tompng merged commit db0a923 into ruby:master Oct 18, 2024
30 checks passed
@tompng tompng deleted the alternate_screen branch October 18, 2024 17:15
matzbot pushed a commit to ruby/ruby that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants