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

fix: preview files containing special \x1b characters as plain text and escape #1395

Merged
merged 8 commits into from
Aug 5, 2024

Conversation

Xerxes-2
Copy link
Contributor

@Xerxes-2 Xerxes-2 commented Aug 2, 2024

fix #1391

image

@sxyazi
Copy link
Owner

sxyazi commented Aug 2, 2024

I think we should preview these ASCII sequences as code, rather than outputting and rendering them directly to the terminal because:

  1. ansi_to_tui only supports a limited set of cases. If these escape codes include cursor movements, it could cause issues.
  2. This is a code previewer, so the expected result should be treated as a code preview, not as actual rendering them.

@Xerxes-2
Copy link
Contributor Author

Xerxes-2 commented Aug 2, 2024

I think we should preview these ASCII sequences as code, rather than outputting and rendering them directly to the terminal because:

  1. ansi_to_tui only supports a limited set of cases. If these escape codes include cursor movements, it could cause issues.
  2. This is a code previewer, so the expected result should be treated as a code preview, not as actual rendering them.

Now the previewer should treat esc as space

@Xerxes-2 Xerxes-2 requested a review from sxyazi August 2, 2024 08:49
@sxyazi sxyazi force-pushed the main branch 2 times, most recently from 33d04f9 to 3fdbbfe Compare August 2, 2024 09:43
@Xerxes-2 Xerxes-2 requested a review from sxyazi August 3, 2024 06:58
@sxyazi sxyazi changed the title fix: preview ascii escape image in yazi#1391 fix: preview files containing special \x1b characters as plain text and escape Aug 5, 2024
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

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

Thanks!

@sxyazi sxyazi merged commit cc50f94 into sxyazi:main Aug 5, 2024
6 checks passed
@Xerxes-2 Xerxes-2 deleted the ascii-escape-preview branch August 5, 2024 11:24
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra symbols remained in the window after trying to preview ASCII escape codes
2 participants