Subject: Patch to move and renumber windows, screen-4.0.3

From: [email-masked]
Date: Wed, 27 Aug 2008 19:09:53 +0000

Hi,

I've written a minor patch against 4.0.3 to add the ability to move
windows right or left (up or down?) slot-by-slot (without using the
:number UI), and also to renumber all active windows starting with 0,
eliminating gaps created by exited windows.

See http://www.quesera.com/reynhout/misc/screen+bumpandcollapse
for more.

This is useful to me -- I often have very long-lived screen instances
on gateway machines that I use to reach dozens of other machines.
Some of those sessions are also very long-lived, but some are very
ephemeral, so I frequently have a mess of windows that I'd like to
reorganize.  :number works well, but can be tedious for large sets.

If this is useful to anyone else, let me know and I'll work out the
remaining details.  Namely:

  - I stole the key sequences from readbuf, writebuf, removebuf.
    Dreadful etiquette, I realize, but the keys (<, >, =) were
    ideal for the purpose, and acceptable for private build use.
    Please let me know if you can think of another good set!

  - The patch is for 4.0.3, but a quick glance at the 4.1.0 code
    suggests that it'll be simple to port.

  - I've written no documentation in the patch.  

Actions are bumpleft (C-a <), bumpright (C-a >), and collapse (C-a =).
They all use the code from RC_NUMBER, extracted out into a fun called
SwapWindows.  I'm not doing any direct wtab manipulation, so hopefully
the patch is as stable as the existing code.  I've tested on OSX and
Solaris in my fairly simple config and use cases, and it works for me.
If you're able to test the patch out, I'll happily take bug reports.

Thank you,
Andrew

-- 
[email-masked]

_______________________________________________
screen-users mailing list
[email-masked]
http://lists.gnu.org/mailman/listinfo/screen-users

---

From: "Thomas Adam" <[email-masked]>
Date: Fri, 29 Aug 2008 14:33:57 +0100

Hello --

>  - I've written no documentation in the patch.

Then until you do, I am going to reject this patch outright.
Regardless of whether or not this patch is applied to GIT in time for
the next release is another matter entirely.  But since you're making
user-visible changes and adding in a new command, the documentation is
a vital part of your patch.

Not having ever looked at the patch (sorry, no time) does it handle
renumbering window in layouts correctly?  Recall that a layout can
have any number of differently numbered windows -- renumbering those
such that it doesn't conflict with another window number in a layout
is going to be an issue.

-- Thomas Adam

---

From: [email-masked]
Date: Fri, 29 Aug 2008 14:03:30 +0000

> Then until you do, I am going to reject this patch outright.

Absolutely.  The patch is not prepared for submission to the repo,
for the above reason as well as the others I mentioned.  And you
raise a new question too, w/r/t layouts, which I'll investigate.

There might well be other things I haven't thought of too, which
is why I posted the patch info -- I've spent a total of about three
hours in the screen source, so if the functionality offered by the
patch has resonance with other folks on the list, I'm interested in
hearing more contextually-aware perspectives on the approach.

In the meantime, the patch works for me in my simple config and
use model, so it might be useful as-is to others.

Thanks,
Andrew

-- 
[email-masked]

---

From: Micah Cowan <[email-masked]>
Date: Fri, 29 Aug 2008 08:50:49 -0700

> such that it doesn't conflict with another window number in a layout

If that's true, wouldn't it already be an issue with the current
RC_NUMBER code?

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
http://micah.cowan.name/

---

From: Micah Cowan <[email-masked]>
Date: Fri, 29 Aug 2008 08:51:04 -0700

> eliminating gaps created by exited windows.

Hi, reynhout, thanks for the patch.

> Actions are bumpleft (C-a <), bumpright (C-a >), and collapse (C-a =).

Sadrul has already added the equivalent functionality for "bumpleft" and
"bumpright", with "number -1" and "number +1" (which are also probably
not yet in the documentation). These don't have bindings by default, but
of course one is quite welcome to set them up in one's ~/.screenrc.

Collapse looks useful, but we'll hold off on this for the time being.
This is the sort of thing that could also make a good use case for
Sadrul's scripting extensions.

- --
Micah J. Cowan