elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.52k stars 296 forks source link

Support semantic prompts (OSC 133) #1808

Open TheDaemoness opened 1 month ago

TheDaemoness commented 1 month ago

What new feature should Elvish have?

There doesn't appear to be an option in edit for the elvish editor to automatically emit OSC 133 codes. These codes allow REPLs/shells to inform a terminal about the structure of their output, enabling features like those of the late Final Term or just wezterm.

This would be possible to implement oneself in rc.elv, except OSC escape codes emitted by the prompt are escaped (heh), which means OSC 133 B (the one that separates the prompt from user input) cannot be emitted at the end of the prompt. Emitting it at the end of edit:before-readline makes the prompt considered part of user input (at least by wezterm), which is unideal.

I'm not much of a Go person, but if there's maintainer interest in this feature, I could probably submit a PR for it.

Output of "elvish -version"

0.20.1+archlinux4

Code of Conduct

iandol commented 3 weeks ago

Kitty's documentation: https://sw.kovidgoyal.net/kitty/shell-integration/