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

Scrolling in read-only mode? #3488

Closed
Andlon opened this issue Mar 5, 2023 · 8 comments
Closed

Scrolling in read-only mode? #3488

Andlon opened this issue Mar 5, 2023 · 8 comments

Comments

@Andlon
Copy link

Andlon commented Mar 5, 2023

Hi. I am using tmux as replacement for screen because it supports read-only sessions, and I'm really only using the most basic feature set (detach and attach), so forgive me if my question does not make sense in a more general context.

I have the problem that if I attach to a session with "read only" mode, I cannot seem to scroll at all. Following this Stackoverflow post, if I try Ctrl + B, [, I only get the message that Client is read-only. So it appears as if you cannot scroll in read only mode. Is this intended behavior? Perhaps my understanding of what "read only" means is off.

I've observed this behavior on tmux 3.1c (Debian 11) and 3.2a (Ubuntu 22.04). I have not yet tested the latest version, but it's not mentioned in the change log, and I suspect I'm not running into a bug, but rather a problem of my understanding. $TERM is xterm-256color outside of tmux and screen inside tmux.

Is there a way to obtain the behavior I want? I want to have something like a read-only session, in the sense that I cannot accidentally write to stdin or press Ctrl + C or similar, but still be able to scroll the output? I'm sorry if this is covered somewhere, but all sources I found so far just referred back to the Ctrl + B, [ shortcut that I mentioned up above.

@nicm
Copy link
Member

nicm commented Mar 7, 2023

copy-mode is not allowed in read only mode.

It could be allowed but checks would have to be added to make it read only (disable the copy commands).

@nicm
Copy link
Member

nicm commented Apr 17, 2023

Added to todo list.

@nicm nicm closed this as completed Apr 17, 2023
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2023
@afh
Copy link

afh commented Aug 18, 2023

I'd like to understand more about this feature request, @Andlon, could you elaborate a bit?

In my tests where I simply added CMD_READONLY to the .flags of struct cmd_entry for the copy or list-keys command for a quick test, yet entering copy mode from the read-only client did also enter copy mode for the session observed.

In my mind copy mode should be "local", i.e. only affecting the read-only client, but not the session it observes.

@Andlon is this also how you envision the feature?

@nicm is a "local" copy mode easily possible in tmux currently or does it go against (core) concepts?

@afh afh reopened this Aug 18, 2023
@nicm
Copy link
Member

nicm commented Aug 18, 2023

No, it is not possible. Just make copy mode allowed for read only clients but don't let them copy. An option allow-read-only-copy-mode would probably be appropriate (you will need to add a member to struct cmd_entry with the option to check for read only commands).

@afh
Copy link

afh commented Aug 18, 2023

If that is not possible, then the clients are no longer truly read-only as their actions affect the read-write session. In my mind that is a no go. Currently read-only clients can switch sessions and detach, but these actions do not affect the sessions.
Am I missing something?

By "don't let them copy" do you mean allow them to manipulate the tmux buffers (save-buffer, set-buffer, etc.)?

@nicm
Copy link
Member

nicm commented Aug 18, 2023

They already can't run set-buffer etc, I mean don't let them copy from copy mode using copy mode commands.

Yes, read only clients entering copy mode would need to be under an option which defaults to off.

@afh
Copy link

afh commented Aug 18, 2023

I seem to have trouble wrapping my mind around this, please allow me read up on copy mode and its command and get back to you on this :)

@nicm nicm closed this as completed Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants