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

OSC sequences are malformed in a prompt #1855

Open
1 task done
cpendery opened this issue Nov 9, 2024 · 2 comments
Open
1 task done

OSC sequences are malformed in a prompt #1855

cpendery opened this issue Nov 9, 2024 · 2 comments

Comments

@cpendery
Copy link

cpendery commented Nov 9, 2024

What happened, and what did you expect to happen?

Similar to #1836, I need to emit non-standard sequences in the prompt for microsoft/inshellisense#138. When trying to emit some OSC sequences prefixing the prompt as shown below, I get the following output in my terminal. It would be great if OSC sequences could be passed through directly to the terminal instead of being parsed / modified as shown below

command

var user_prompt = $edit:prompt
fn prompt {
    put "\x1b]6973;PS\x07"
    $user_prompt
}
set edit:prompt = { prompt }

resulting prompt

^[]6973;PS^G~\OneDrive - Microsoft\Documents\code\clac>

Output of "elvish -version"

0.21.0+official

Code of Conduct

@MrOverlord
Copy link

For what it is worth, I think you can basically achieve the desired effect via the edit:before-readline hook. In my case (emitting escape sequences to enable jumping between prompts in the Foot terminal emulator) the following works, while injecting them into the prompt led to junk being printed:

set edit:before-readline = [$@edit:before-readline { printf "\e]133;A\e\\" } ]

@cpendery
Copy link
Author

I need to track multiple points of the prompt (points a-d as show below) which I don't think I can achieve with the hooks. These hook look great for reporting other information though (cwd, last command's status, etc).

aprompt>b                                                                                             c[right-prompt]d

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

2 participants