Skip to content
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

no ability to copy multiline blocks from zellij inside alacritty #363

Open
ardentperf opened this issue Jan 12, 2025 · 17 comments
Open

no ability to copy multiline blocks from zellij inside alacritty #363

ardentperf opened this issue Jan 12, 2025 · 17 comments

Comments

@ardentperf
Copy link

the omikub docs on copy/paste say to use the SHIFT key for copy/paste in the terminal

https://manual.omakub.org/1/read/34/clipboard

unfortunately, this does not work for multiline text because it space-pads everything and adds the zellij border to the copied text, which i then have to clean up in an editor. this makes copy/paste pretty unusable for anything with multiple lines, which is sortof a dealbreaker for a lot of real work

not sure i can continue using zellij inside alacritty unless i can find a solution to this - i need to be able to copy text from the terminal, especially when working on documentation

@ardentperf
Copy link
Author

I did see this over in the zellij github, haven't had time yet to dig and see if there's something in that thread which might help here zellij-org/zellij#996

@florentdestremau
Copy link
Contributor

#105 you can remove the border

@florentdestremau
Copy link
Contributor

...tho I agree this is maybe the biggest thing making me hate the terminal combo of omakub. The text selection, copy and pasting just plain sucks. Multi line select is not a single line wrapped, it's litteraly n lines of text truncated. I can't understand how this can be so hyped and fail so big in this area.

Thinking about copying a log entry from a terminal in a panel? sucks.
Thinking about copying a long token in a .env file ? sucks.
Thinking about selecting anything? need to remove the border before, put it back after.. sucks.

@florentdestremau
Copy link
Contributor

Okay following my rant I actually asked Chat-GPT and it seems like the real solution is to switch into scroll mode with Ctrl + S and then you can

  • select with Shift + Click and drag with mouse inside the borders (!) and then Ctrl + Shit + C to copy
  • select with "Click and drag" with your mouse and it's auto-copied

So it's wayyy better than removing borders.

@florentdestremau
Copy link
Contributor

@dhh this might be a good addition to the writebook manual

@ardentperf
Copy link
Author

switching into scroll mode fixed it for me! thanks!

i agree it could be a good addition to the manual

@dhh
Copy link
Member

dhh commented Feb 3, 2025

Yes, please do suggest a place / wording in this PR and I'll add.

@imsnif
Copy link

imsnif commented Feb 5, 2025

Friendly suggestion if I may: many (all?) of these issues will go away if you mark text with the mouse without holding down shift (assuming mouse_mode is not disabled in the Zellij config).

Holding down shift means that the mouse events bypass Zellij and are handled by the terminal emulator (Alacritty in this case), which doesn't know about the Zellij pane frames or line wraps, and thus usually doesn't do what you want.

If you mark text with the mouse without holding down shift, Zellij will handle the selection and copying and it should "just work". Happy to help troubleshoot if you were using the shift as a workaround to some issue.

@dhh
Copy link
Member

dhh commented Feb 5, 2025

Yeah, I've been using shift, but it is indeed a pain that it doesn't know about panes. So would also be nice to fix the underlying issue here with the highlighting and consisting copy.

@imsnif
Copy link

imsnif commented Feb 5, 2025

Yeah, I've been using shift, but it is indeed a pain that it doesn't know about panes. So would also be nice to fix the underlying issue here with the highlighting and consisting copy.

Does it not work for you if you don't use shift?

@dhh
Copy link
Member

dhh commented Feb 5, 2025

Shift works in terms of copying. That's what I'm using. But it is not zellij aware, so it copies the pane characters etc.

@imsnif
Copy link

imsnif commented Feb 5, 2025

By default, Zellij should be able to handle marking/copying and be pane aware. This is how it looks like for me (not holding shift here):

2025-02-05.11-56-23.mp4

If it looks differently for you, it could be a configuration/theme issue which I'd be happy to help troubleshoot - but I need to understand what you're experiencing to find out what's wrong.

@florentdestremau
Copy link
Contributor

Oh I think this goes back to the very first issues in that the highlighting is not visible by default if not using SHIFT key. But it's true it actually works. Seems like setting the scroll mode somehow make the highlighting more visible hence looks like a solution.

As you can see in this video:

  • when in my darkmode theme ("tokyo night"), i can select text without SHIFT but i need to copy Ctrl + Shift + C while keeping my mouse clicked and it then copies the content. The shift selection stays selected anyways (and requires a shift click to go away)
  • when in light mode theme ("Rose Pine"), the same thing works but I can't see the selection I'm doing without pressing shift while dragging my mouse click.
Screencast.from.2025-02-06.15-39-10.mp4

@florentdestremau
Copy link
Contributor

see #105 (comment)

@imsnif
Copy link

imsnif commented Feb 6, 2025

Thanks for the info @florentdestremau !

FYI: When Zellij marks text (i.e. without holding shift) we copy it to the clipboard on mouse-release. You don't need to press anything. I can understand though why this was unclear in the specific setup Omakub uses (more below).

I see two issues here:

  1. The selection color in Zellij is sometimes the same as the terminal background color of the terminal, so you can't see it and thus get the impression that it's not working.
  2. The Zellij UI indication that text has been copied to clipboard (which happens upon mouse-release*) does not appear in the compact layout used by Omakub. So it's hard to understand that something happened and the text was actually copied.

I'll fix both points for the next Zellij release (hopefully happening sometime this month). Meanwhile as a workaround, you can change the Zellij theme's bg color to at least work around point 1.

*you can see it in the bottom-bar in my video

@florentdestremau
Copy link
Contributor

This is much clearer now, thanks for chiming in @imsnif !
I'm not personnaly sold on the ux choice as i prefer the shift selection process for other reasons: double-click on words, triple click for line selection... Is there a best of both worlds possible ? 😆

@imsnif
Copy link

imsnif commented Feb 6, 2025

double-click on words, triple click for line selection... Is there a best of both worlds possible ? 😆

This is a much requested feature that I hope to get to at some point, but I unfortunately have no ETA at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants