screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mouse scrolling and scroll bars ideas (long)


From: Michael Grant
Subject: mouse scrolling and scroll bars ideas (long)
Date: Mon, 15 Aug 2022 19:03:31 -0400

I've been using gnu-screen now for many years.  I use it through PuTTY
almost exclusively.  On the Linux/Unix side, I'm in the shell, emacs,
and vi.  When I'm in emacs (and vi as well), I have it set so that the
mouse wheel scrolls the emacs buffer.  Similar in vi.

I thought I saw a mode in Screen which the mousewheel controlled
scrolling Screen's scrollback buffer in scrollback mode.  Or maybe I'm
misremembering and maybe it was tmux?  If this works in Screen, could
someone please tell me how to turn that on?

This got me thinking about an easier way to use the scrollback buffer
with the mouse.

I'd like to be able to enter scrollback mode simply by scrolling up
the mousewheel at the shell prompt.

I'd like to be able to select text using the left mouse button and
paste it in with the right mouse button (like PuTTY in fact).  This
would need to happen within screen because at PuTTY's scroll buffer
gets pretty messed up if you are trying to select/copy/paste more than
a screenfull and you've changed screens.

I know you can do this using the keyboard, what I'm after is the
convenience of being able to do this with the mouse as well.  Emacs
and vi can set the terminal in the mouse tracking mode (esc-[1000h)
and get the mouse reporting and Screen is aware which screens are in
that mode so it seems technically possible.

Next, I'd love to have scroll bars to scroll back up into Screen's
scrollback buffer.  Character based using say white and black spaces
would be fine.  Click on the elevator and you should be able to drag
around Screen's scrollback buffer.  I'm imaginging a Screen scrollbar
on the right (or left) which was not part of the tty.  If there are
multiple screens on the screen (split screen), all get their own
scrollbars.

I know PuTTY has it's own scrollback buffer but it gets pretty messed
up if you switch screens and it's empty if you log back in and
reattach.  I'm really looking for a mousey way to get at Screen's
scrollback region which acts more or less like PuTTY in a single
window.

One thing which this would break would be copying text from PuTTY into
another application such as another PuTTY window.  I don't know of any
escape sequence that would tell PuTTY to fill or return the paste
buffer from the machine.  And frankly being able to randomly pull the
machine's paste buffer is a security hazard.  Even being able to send
something to the past buffer would be a security hazard--think of the
possibilities of something mean sending "rm -r *\n" to the paste
buffer randomly!  I think PuTTY mitigates this sort of thing now by
displaying what you just pasted in inverted color text so you can stop
the paste before it gets pasted.  Regardless, being able to control
the application's paste buffer would require a change to the terminal
program (PuTTY in my case).  This is unlikely to happen and frankly
not necessary.

In PuTTY (nothing to do with Screen), one can shift-drag to select
text on the screen and fill the local machine's paste buffer.
shift-right click pastes back.  This allows you to copy-paste stuff
that's on the visible window.  But what if you needed to copy
something that had scrolled off the screen (that was only intact in
Screen's scrollback buffer)?

There is a way...  What you can do is always push lines off the top of
the screen into PuTTY's scrollback buffer.  It is also possible to
replay Screen's scrollback buffer into PuTTY's scrollback buffer, I
have written a hack to do this which I bind to C-a C-l.  Shift-scroll
or would allow you to shift-click/drag and copy a large amount of text
like you can do today.  This is possible today when emacs captures the
mouse, you can shift-scroll and scroll PuTTY's window and
shift-select/copy stuff just fine.  A little care would have to be
taken when screens have a modeline at the bottom and switching
screens.  A screen command to replay a screen off into the PuTTY's (or
any terminal window's) scrollback buffer would allow someone to
shift-scroll up to it if needed.

To be clear, scrolling back up into Screen's scrollback buffer should
work when other applications haven't taken the mouse, as in emacs or
vi.  Once you are in emacs or vi, the mouse clicks go to those
programs and Screen would leave them alone.  If you're using an editor
like this in a screen, it wouldn't make any sense to go back into
Screen's scrollback buffer anyway.

In summary, I think what would need to be implemented:

1) scroll wheel automatically enters screen scrollback mode, this
implies that the terminal is in esc[1000h mode.

2) select with mouse drag and paste with right-click from screen's
buffer similar to PuTTY or at least with some options to be able to
act like PuTTY's mouse buttons.

3) extra care taken when things scroll off the screen to create
consistent scrollback buffer for programs such as PuTTY or other
terminals that have scrollback buffers and a built-in way to replay a
screens scrollback buffer into the window.

4) virtual scrollbars around screens which are clickable and
dragable.

(1) may already be implemented unless it's tmux I'm recalling that had
that feature.

Even if without virtual scrollbars (i guess that could be hard), 1-3
above would be really useful to have.

Hoping this is some food for thought!  I'm hoping Screen development
isn't dead and it's still possible to make this great utlilty better!

Michael Grant

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]