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

Cannot use escape sequences in prompt #515

Closed
gwsw opened this issue May 20, 2024 · 2 comments
Closed

Cannot use escape sequences in prompt #515

gwsw opened this issue May 20, 2024 · 2 comments

Comments

@gwsw
Copy link
Owner

gwsw commented May 20, 2024

2a642a0 which fixes #503 breaks the ability to include escape sequences in prompts.

Steps to reproduce:
Run echo hello | less -R -Ps$(printf '\e[41mred\e[m')

Expected result:
Prompt should be "red", colored red.

Actual result:
Prompt is "ESC[41mredESC[m".

@gwsw
Copy link
Owner Author

gwsw commented May 20, 2024

Also breaks the "v" command when the filename contains nonprintable characters.

Steps to reproduce:

  1. Run echo hello > 'tab^Ifile' where the ^I is a literal tab character
  2. Run less 'tab^Ifile'
  3. Type v

Expected result:
Run an editor on the file

Actual result:
Runs editor on the nonexistent file tab^Ifile, where the ^I is the two characters "^" and "I".

gwsw added a commit that referenced this issue May 20, 2024
Change 2a642a0 introduced a regression
where a prompt set by -P is converted to printable form before printing.
This breaks using escape sequences to affect the formatting
of prompt strings.

Now only filenames in a prompt are converted to printable form,
rather than the entire prompt (previously implemented
in 2cdb984).

related to #515
@gwsw
Copy link
Owner Author

gwsw commented May 22, 2024

Fixed in bf14bc4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant