On Fri, 13 Apr 2018 17:36:12 +0100
David Woodfall <d...@dawoodfall.net> wrote:

> Is it possible to detect when inside a split so I can use a switch in
> my caption string?
> 
> I'm using %F to detect if the region has focus and dim the other
> window names. This is OK in a split because it hides the other window
> names, but when in a single screen with no splits I'd like to make
> the list a bit more visible if possible.
> 

Hi,

as far as I know there is no way, so I made a quick patch.
Need time to decide whether I should apply it, so you should apply it
yourself for now.

Cheers,
Amadeusz
>From 850ea567f059b97adbfb71f7d530d2b54360f066 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <am...@asmblr.net>
Date: Tue, 24 Apr 2018 20:10:51 +0200
Subject: [PATCH] add Z escape code to check if screen is split

example usage:
hardstatus alwayslastline "%?%Z SPLIT %: nosplit %?"
caption always "%?%Z SPLIT %: nosplit %?"
---
 src/process.c | 1 +
 src/screen.c  | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/process.c b/src/process.c
index ec5a9114..183ee116 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4094,6 +4094,7 @@ int key;
       else
         AddCanvas(SLICE_VERT);
       Activate(-1);
+      WindowChanged((struct win *)0, 'Z');
       break;
     case RC_REMOVE:
       RemCanvas();
diff --git a/src/screen.c b/src/screen.c
index c3417e30..23bb7036 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2962,6 +2962,15 @@ char *MakeWinMsgEv(char *str, struct win *win, int esc, int padlen, struct event
       }
 	  break;
 
+    case 'Z':
+      if (display && D_forecv) {
+        struct canvas *cv = D_forecv;
+        p--;
+        if (cv->c_slnext || cv->c_slprev)
+          qmflag = 1;
+      }
+      break;
+
     case 'n':
       s++;
       /* FALLTHROUGH */
-- 
2.17.0

_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to