-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Clipboard contents lost when hx
used as scrollback buffer editor within zellij session
#5424
Labels
Comments
Thanks for the detailed reproduction! Looks like we'd need to call |
gavynriebau
added a commit
to gavynriebau/helix
that referenced
this issue
Jan 6, 2023
gavynriebau
added a commit
to gavynriebau/helix
that referenced
this issue
Jan 6, 2023
gavynriebau
added a commit
to gavynriebau/helix
that referenced
this issue
Jan 13, 2023
archseer
pushed a commit
that referenced
this issue
Jan 16, 2023
gibbz00
pushed a commit
to gibbz00/helix
that referenced
this issue
Jan 17, 2023
* Fix for lost clipboard contents (helix-editor#5424) * PR feedback: Call "setsid" for all unix systems * PR Feedback: Only install libc for unix targets
kirawi
pushed a commit
to kirawi/helix
that referenced
this issue
Jan 25, 2023
* Fix for lost clipboard contents (helix-editor#5424) * PR feedback: Call "setsid" for all unix systems * PR Feedback: Only install libc for unix targets
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
I am using zellij as a terminal multiplexer/session manager (e.g. like
tmux
), below I will provide info related to zellij but please hear me out before closing this issue because I think the bug lies withinhx
itself and notzellij
and I will explain why.Zellij
contains an "edit scrollback buffer" feature whereby one can press<Ctrl-s>
and it dumps the current scrollback buffer to a temporary file before spawning whatever program you've configured as your scrollback editor (defaults to $EDITOR or $VISUAL contents).I have found that when I use
hx
as my scrollback buffer editor the contents of the clipboard are lost as described in the bug reproduction steps.However, when I configure
nvim
as my scrollback buffer editor the copy/paste behaviour works perfectly fine and clipboard contents are not lost.I have done some investigation and I believe the problem, which only occurs when using
hx
as the scrollback editor, is likely due to differences in howxclip
is spawned.Specific differences in how
xclip
is spawned:hx
does not callsetsid
before spawning and calls xclip with the argsxclip -i -selection clipboard
nvim
callssetsid
before spawning and calls xclip with the argsxclip -quiet -i -selection clipboard
This is a dump of relevant
htop
output when usingnvim
to do a copy/paste within scrollback editing:Note that the session ID and process group ID of
xclip
is different to that ofnvim
, I believe that is because nvim callssetsid
before exec'ingxclip
.Now here is a dump of relevant
htop
output when usinghx
to do a copy/paste:Note that the session ID and process group ID of
xclip
is the same as that of the spawnedhx
.My suspicion is that when
hx
is closed the spawnedxclip
process is also closed because they are both in the same session / process group. Pasting then fails becausexclip
has been closed and X11 no longer has a source from which to get the clipboard contents.Reasons I believe the bug is within
hx
and notzellij
:nvim
as my scrollback editorhx
to callfork
thensetsid
before launchingxclip
for copying and confirmed this fixes the bug.Reproduction Steps
Environment setup:
~/.config/zellij/config.kdl
scrollback_editor
to the location ofhx
, e.g."/usr/local/bin/hx"
To reproduce the bug itself:
zellij
to start a new session running version 0.34.4 of zellijls -l
to produce some terminal output<Ctrl-s>
to trigger scrollback edit mode (this dumps terminal contents to a file and openshx
for editing it).hx
to select some text then press<Space>y
to yank to clipboard:q!
to quithx
I expected this to happen:
The yanked text would be pasted
Instead, this happened:
Nothing is pasted
Additional info
It is only at step 8 (where
hx
is closed) that the clipboard contents are lost.If the above steps are taken but step 8 is skipped, the copy/paste process works correctly. This is not ideal because the workflow I want to use is to use scrollback editing to quickly copy a subset of the terminal output text.
Helix log
No response
Platform
Linux (X11 running BSPWM)
Terminal Emulator
Alacritty 0.11.0
Helix Version
helix 22.12 (96ff64a)
The text was updated successfully, but these errors were encountered: