resurrect.wezterm icon indicating copy to clipboard operation
resurrect.wezterm copied to clipboard

Restore lines for non-local domains

Open MLFlexer opened this issue 1 year ago • 5 comments

See discussion from this comment. Currently there is no way to restore the lines for WSL and SSH domains, but it seems like there might be a way to do so as per the discussion in #39.

MLFlexer avatar Aug 16 '24 19:08 MLFlexer

Continuing discussion from #39 here @joncrangle:

I agree. This is promising but is a separate feature and could use more testing. I think the solution will involve some variation of the following Wezterm lua functions to get the pane_id and return the scrollback text from it:

root.pane:pane_id() -- 23 was the pane_id for my SSH domain session
wezterm.mux.get_pane(23):get_lines_as_escapes(1000))

It might also make sense to abstract the get_lines_as_escapes into its own local function.

That should be the same behaviour as just root.pane:get_lines_as_escapes(1000) when saving the pane

MLFlexer avatar Aug 16 '24 19:08 MLFlexer

I found I was unable to inject output in panes within domains, and found this in the docs:

"Not all panes support this method; at the time of writing, this works for local panes but not for multiplexer panes."

MLFlexer avatar Aug 17 '24 15:08 MLFlexer

For now I see several directions this could be taken.

  1. Do not save the text for non-local domains
  2. use get_lines_as_text to store the text only and then send it to the pane with send_text forcing either the user to ctrl-c or we insert a ctrl-c control sequence at the end.
  3. Spawn the pane with a command like printf <text> ; sh

One of these are great tho :neutral_face:

MLFlexer avatar Aug 17 '24 16:08 MLFlexer

For now I see several directions this could be taken.

  1. Do not save the text for non-local domains
  2. use get_lines_as_text to store the text only and then send it to the pane with send_text forcing either the user to ctrl-c or we insert a ctrl-c control sequence at the end.
  3. Spawn the pane with a command like printf <text> ; sh

One of these are great tho :neutral_face:

I'd be interested in whether others have feedback, because this is not a feature I'm overly concerned about for my personal workflow.

This plugin currently satisfies the pain point I was having by reattaching to SSH and SSHMUX sessions. SSHMUX sessions are already very similar to tmux in that running processes are continued as long as the Wezterm daemon on the server side is still running. I am personally less concerned about the scrollback, but can completely understand if someone else would find it useful.

joncrangle avatar Aug 17 '24 16:08 joncrangle

For now I think not saving lines for non-local panes is the best option, but if someone is reading this and has input on this, please feel free to provide ideas or feedback 😄

MLFlexer avatar Aug 18 '24 08:08 MLFlexer