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

Consider adding OSC 133 #5850

Open
kchibisov opened this issue Feb 3, 2022 · 13 comments
Open

Consider adding OSC 133 #5850

kchibisov opened this issue Feb 3, 2022 · 13 comments

Comments

@kchibisov
Copy link
Member

This allows some basic shell integration and the protocol seems like supported by some major modern terminals (kitty/iterm2).

Adding it should be relatively easy and shouldn't impact performance at all.

I'm not sure that adding all of them makes sense for us, but ability to just mark prompt should be fine.

The relevant spec could be found https://iterm2.com/documentation-escape-codes.html.

@kchibisov
Copy link
Member Author

Also, I think it should be restricted in alt-screen?

@chrisduerr
Copy link
Member

chrisduerr commented Feb 3, 2022

Also, I think it should be restricted in alt-screen?

would just be a no-op in alt screen, wouldn't it? Pretty sure that should work automagically.

kchibisov added a commit to kchibisov/alacritty that referenced this issue Feb 6, 2022
Adds support for setting prompt marks with OSC 133 ; A ST. While
there're other markers for prompt `FTCS_PROMPT` (`A` parameter) is
likely the most widely used and useful one.

Fixes alacritty#5850.
kchibisov added a commit to kchibisov/alacritty that referenced this issue Feb 6, 2022
Adds support for setting prompt marks with OSC 133 ; A ST. While
there're other markers for prompt `FTCS_PROMPT` (`A` parameter) is
likely the most widely used and useful one.

Fixes alacritty#5850.
kchibisov added a commit to kchibisov/alacritty that referenced this issue Mar 4, 2022
Adds support for setting prompt marks with OSC 133 ; A ST. While
there're other markers for prompt `FTCS_PROMPT` (`A` parameter) is
likely the most widely used and useful one.

Fixes alacritty#5850.
kchibisov added a commit to kchibisov/alacritty that referenced this issue Mar 4, 2022
Adds support for setting prompt marks with OSC 133 ; A ST. While
there're other markers for prompt `FTCS_PROMPT` (`A` parameter) is
likely the most widely used and useful one.

Fixes alacritty#5850.
@kchibisov
Copy link
Member Author

I don't think that adding this escape sequence will provide any value due ability to implemented it yourself with bindings due to 586f982.

I wouldn't close this issue out right, but I don't think this escape sequence will add anything our macro like bindings can't do. Especially given that the escape sequence is unclear an complicated.

There's a part of the escape sequence talking about last prompt copy, but it's useless due to !! shell builtin for more you can arrow cycle.

@nixpulvis
Copy link
Contributor

Curious, as a developer of an application/shell, how would this make my life easier better? Let's say I emit the correct starts and ends for commands run by the user. What actions would I be able to do with this? Do other applications look for these escapes? Would we track them for our own internal tracking of commands (seems wrong).

When I've played with writing shells in the past, I've considered adding command tracking (even in parallel with jobs support), but I'm not sure what terminal features are really needed.

The killer feature is probably "Jump to Last Command", which if I understand you correctly @kchibisov you think should be implementable with out existing bindings? What would that look like without this OSC?

Hopefully I'm thinking along the right lines here. It's been a little while since I gave this much thought.

@kchibisov
Copy link
Member Author

Curious, as a developer of an application/shell, how would this make my life easier better? Let's say I emit the correct starts and ends for commands run by the user. What actions would I be able to do with this? Do other applications look for these escapes? Would we track them for our own internal tracking of commands (seems wrong).

it's only for the terminal itself.

The killer feature is probably "Jump to Last Command", which if I understand you correctly @kchibisov you think should be implementable with out existing bindings? What would that look like without this OSC?

  { key = "P",      mods = "Control|Shift", mode = "~Vi|~Search",  action = "ToggleViMode" },
  { key = "P",      mods = "Control|Shift", mode = "~Vi|~Search",  action = "SearchBackward" },
  { key = "P",      mods = "Control|Shift", mode = "~Vi|~Search",  chars = " " },
  { key = "P",      mods = "Control|Shift", mode = "~Vi|~Search",  action = "SearchConfirm" },

@nixpulvis
Copy link
Contributor

I can’t tell at the moment, is that chars searching for a specific invisible character?

@kchibisov
Copy link
Member Author

yeah, it's a special space char.

@halvabner
Copy link

halvabner commented Sep 15, 2023

Hello, looks like PreviousCommand and other actions were added to the commit but now they're no longer there?
I am getting [alacritty_config_derive] Config error: unknown keyboard action 'PreviousPrompt'; ignoring binding when I try to use them

I tried @kchibisov 's solution (had to change some things to make it parseable)

  - { key: P,    mods: Control|Shift,    mode: ~Vi|~Search,  action: ToggleViMode }
  - { key: P,    mods: Control|Shift,    mode: ~Vi|~Search,  action: SearchBackward }
  - { key: P,    mods: Control|Shift,    mode: ~Vi|~Search,  chars: "test" }
  - { key: P,    mods: Control|Shift,    mode: Search,  action: SearchConfirm }  # errors if ~Vi|~Search

but the chars won't get written in the search bar

I don't know what to try to get this feature at this point

@kchibisov
Copy link
Member Author

@halvabner you need master built to make it work.

@halvabner
Copy link

@kchibisov sorry, can you elaborate please? Are you suggesting I am not running a master branch build? I have alacritty 0.12.2 (9d9982df) using this build when I check. Where are the build instructions to build the version you refer to?

@kchibisov
Copy link
Member Author

if you're on arch, you need alacritty-git from aur. The instructions on how to build yourself are in INSTALL.md.

@halvabner
Copy link

@kchibisov and how do you specify OSC character? I tried

[[keyboard.bindings]]
chars = '�]133;A�\'
key = "P"
mode = "~Vi|~Search"
mods = "Control|Shift"

which won't get parsed. I also tried writing bytes
image

@kchibisov
Copy link
Member Author

They are not part of the grid. Just use some unique character in your prompt, like some unicode variant of space or some arrow character you could have.

Besides, TOML uses \u for unicode input.

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

Successfully merging a pull request may close this issue.

4 participants