Open ModProg opened 2 years ago
Thinking aloud from the peanut gallery:
I'd be inclined to use the existing semantic zones concept (OSC 133, described in https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md which also originates from DomTerm) to demark the input region, then "simply" use that to compute the number of left or right moves to get to the appropriate place and just send that many moves without waiting to see how the cursor really moves.
There are still potential problems with tmux/jexer that might need an alternative/expanded OSC 133 sequence to define the input region, maybe using an ID similar to how OSC 8 logically connects a hyperlink in similar situations.
I'm not entirely sure how https://www.warp.dev/ does it, but their text-editing capabilities (especially multi-line and multi-cursor) look very compelling.
Demo: https://www.loom.com/share/1517049fefc34227bf1abaf19cc7e6ea?t=1
My educated guess is that warp use OSC 133 style escapes that indicate when a prompt is in use, and then they replace your shell prompt with their own editor.
My first-hand experience with https://fig.io/ is that they also use OSC 133 style escapes (but with their own OSC code) together with an additional PTY process that wraps around the other side of the shell and then they use the macOS accessibility API to augment the existing shell prompt with suggestions.
OR, a radical idea: We render the terminal (and the prompt) in a top pane We have a real editor to craft the new command in a bottom pane
I really doubt if that's exactly what warp does. If you watch the demo on their front page, especially here https://www.warp.dev/#:~:text=Input%20that%20feels%20like%20a%20code%20editor you will probably have the same guess
To be clear: I personally have very little interest in building an alternative editor for this sort of thing, as there are a lot of complexities and product surface: the shell has had decades of work on programmable command line completion and highlighting and other functions that require access to the host on which the shell is running. There's a lot of work to replicate what the shell does to a degree where it wouldn't be a regression over what we currently support by simply not trying to get in the way :)
It's also not something that I need for myself: I know how to tell my shell's line editor to open my favorite editor to edit a multi-line command when I need it (https://unix.stackexchange.com/questions/6620/how-to-edit-command-line-in-full-screen-editor-in-zsh has examples for zsh for example), so spending my time on that doesn't benefit me personally.
I totally agree. And that's not the point of this issue either. I was simply pointing out how others might have implemented the mouse support.
I totally agree. And that's not the point of this issue either. I was simply pointing out how others might have implemented the mouse support.
:man_shrugging: People use the mouse in a terminal? huh? lol
I totally agree. And that's not the point of this issue either. I was simply pointing out how others might have implemented the mouse support.
🤷♂️ People use the mouse in a terminal? huh? lol
There are cases where you mostly reuse past commands and have to make some minor changes, it's faster to move the cursor to the editing position with the mouse on one hand and make the small modifications with the other hand. Depending on your job sometimes you end up doing that very frequently.
OR, a radical idea: We render the terminal (and the prompt) in a top pane We have a real editor to craft the new command in a bottom pane
Something similar to this was implemented by several BBS-era programs. They called it split-screen.
Example:
Konsole has this feature now as well
I wish could have this features.
Kitty also has this feature. I'm pretty sure it also uses OSC 133
Is your feature request related to a problem? Please describe. When havin long or multiline command lines it is time consuming to move to the correct position via keyboard
Describe the solution you'd like Have a keycombination where you can click at a position, and if possible, the curser will move there through key input.
Describe alternatives you've considered I though about implementing that via config, but there is no way to tell the mouse position and the current cursor position so this is not possible.
Additional context There are some terminals that have this: http://domterm.org/Tips.html#move-cursor-with-mouse https://apple.stackexchange.com/questions/42825/option-click-in-iterm
Possible issues At we should move
horizontally
first and thenvertically
as vertical movement traverses history in a lot of shells.