-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
VT extension to grab text output by named regions (blocks) #1302
Comments
Have you considered implementing the FinalTerm And if your terminal has that information (knowing which parts of the buffer are the prompt, the command, and the command output), then I think you probably already have the ability to replicate a lot of that Terminal.Click functionality. I'm not sure why you want a sequence to grab text from the buffer, though. I would have thought you'd be adding this functionality in the terminal itself, which already has access to the entire buffer? But if you are going to implement something like that, note that some people consider escape sequences that can read the buffer to be a security risk, so it may be a good idea to have an option to disable that. |
Hey @j4james. Thanks for reminding me. I knew about FinalTerm's ideas and I have to check more in depth to see if FinalTerm's VT extensions suffice for what I am aiming for (it's not just mimmicking terminal.click's idea, but also to mimic what Warp is doing with their blocks (#1010) and #836.
We're already having some kind of permission wall for features that some users might consider questionable (font face/size change via VT seq). Those things in Contour always default to "ask" (the TE is opening a popup to ask the user if he/she wants that action to be taken). The user may then act on it, or simply have it configured to be permanently allowed/denied. I personally feel pretty safe with giving the user a choice of protection (as well as freedom) here. Whenever I'm going to start working on it, I'll most likely start triggering a small discussion round in case I feel like we should divert from FinalTerm or similar. I'll keep you posted. ;) |
There is the idea by Terminal.Click to access the last executed commands output by a special mouse movements of the upper command's output region into the command, which seems to then inject the name of a temporary file.
Proper VT-way solution
Introduce a way to mark and name regions, and give a way to access the last N regions by that name to access its textual contents.
OSC 512 ; NAME ST
OSC 512 ST
OSC 513 ; NAME ST
A requested region will be sent back to the application in chunks in the following form
The end of input will be denoted with an empty data reply.
p.s.: OSC numbers may potentially change in the future. I just picked (hopefully not conflicting) random numbers.
Feature Detection
My first thought and suggestion would be to make that discoverable either via DA1, or via a DEC mode. The DEC mode would maybe have the possible advantage of being runtime configurable.
Application uses
A potential future shell (integration) could use that to mark CLI output that way, and have the possibility to retrieve that output back by the given names. If the user (given the shell would implement it like that) would then type
grep foobar $OUTPUT{1}
where$OUTPUT{1}
would reflect the most recent completed command, the shell could pre-fetch that content, put it into a temporary file, and replace$OUTPUT{1}
with the appropriate temporary file, to make it work withgrep
.Positive side effects
This could also be the basis for #836, #1010.
The text was updated successfully, but these errors were encountered: