Implement custom OSC(?) to set a jump mark, and add key binding to jump to it #30

Closed
opened 2 years ago by dnkl · 1 comments
dnkl commented 2 years ago
Owner

Mainly intended to be able to jump to the beginning of the previous command. This could be done by configuring the shell to emit the escape (in e.g. PS1).

In its simplest form, we would only keep track of one jump mark. But it shouldn't be too difficult to extend it.

I believe iTerm2 has this feature. It might make sense to re-use the same escape(s).

Mainly intended to be able to jump to the beginning of the previous command. This could be done by configuring the shell to emit the escape (in e.g. `PS1`). In its simplest form, we would only keep track of **one** jump mark. But it shouldn't be too difficult to extend it. I believe iTerm2 has this feature. It might make sense to re-use the same escape(s).
dnkl added the
enhancement
label 2 years ago
Poster
Owner

OSC 133;A is a fairly standard escape to mark the start of a prompt. See "Shell Integration/FinalTerm" in https://iterm2.com/3.0/documentation-one-page.html.

My plan is to have a per-row boolean value that indicates whether there's a prompt on this row or not. It is set on the "current" row when we receive a OSC 133;A sequence.

Then, we'll add two key bindings, prompt-prev and prompt-next.

prompt-prev jumps to the previous, currently not visible, prompt, and prompt-next jumps to the next prompt that isn't at the top of the screen.

In other words, the implementation will be more or less stateless. The only thing we'll track is whether a row has a prompt or not. This shouldn't even increase the run-time memory usage, since the row struct is currently being padded.

`OSC 133;A` is a fairly standard escape to mark the start of a prompt. See _"Shell Integration/FinalTerm"_ in https://iterm2.com/3.0/documentation-one-page.html. My plan is to have a per-row boolean value that indicates whether there's a prompt on this row or not. It is set on the "current" row when we receive a `OSC 133;A` sequence. Then, we'll add two key bindings, `prompt-prev` and `prompt-next`. `prompt-prev` jumps to the previous, currently not visible, prompt, and `prompt-next` jumps to the next prompt that isn't at the top of the screen. In other words, the implementation will be more or less stateless. The **only** thing we'll track is whether a row has a prompt or not. This shouldn't even increase the run-time memory usage, since the row struct is currently being padded.
dnkl self-assigned this 6 months ago
dnkl closed this issue 6 months ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: dnkl/foot#30
Loading…
There is no content yet.