screen-devel
[Top][All Lists]
Advanced

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

[screen-devel] [PATCH] "killright" command


From: Stefanus Du Toit
Subject: [screen-devel] [PATCH] "killright" command
Date: Sun, 15 Aug 2021 17:06:38 +0800

This small patch adds support for killing all windows to the right of
the current one.

This is useful if you tend to have a few "persistent" windows on the
left and more ephemeral ones on the right.

It's based on the screen-v4 branch. If there's any interest I'm happy
to add documentation, etc.

========
diff --git a/src/comm.c b/src/comm.c
index 90eaa7e..f37b2ec 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -218,6 +218,7 @@ struct comm comms[RC_LAST + 1] =
   { "kanji",           NEED_FORE|ARGS_12 },
 #endif
   { "kill",            NEED_FORE|ARGS_0 },
+  { "killright",       NEED_FORE|ARGS_0 },
   { "lastmsg",         CAN_QUERY|NEED_DISPLAY|ARGS_0 },
   { "layout",           ARGS_1|ARGS_ORMORE},
   { "license",         NEED_LAYER|ARGS_0 },
diff --git a/src/process.c b/src/process.c
index 004b22a..4d31efb 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1356,6 +1356,22 @@ int key;
          free(name);
        break;
       }
+    case RC_KILLRIGHT:
+      {
+       n = 0;
+       if (key >= 0)
+         {
+           Input("Really kill all windows to the right [y/n]", 1,
INP_RAW, confirm_fn, NULL, RC_KILLRIGHT);
+           break;
+         }
+       while (NextWindow() > fore->w_number)
+         {
+           KillWindow(wtab[NextWindow()]);
+           ++n;
+         }
+       OutputMsg(0, "%d windows killed.", n);
+       break;
+      }
     case RC_QUIT:
       if (key >= 0)
        {
========

Stefanus

Attachment: 0001-Add-killright-command.patch
Description: Binary data


reply via email to

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