screen-devel
[Top][All Lists]
Advanced

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

[screen-devel] Added T-flag for w-/W-escapes to bold titles for inactive


From: Mattias Ahlbäck
Subject: [screen-devel] Added T-flag for w-/W-escapes to bold titles for inactive windows
Date: Fri, 2 Dec 2011 01:10:29 +0100

Hi list!
I've made some small modifications allowing one to visually separate info in the hardstatus window list(s) by making inactive window titles stand out from numbers and flags.

I'd also like to take the opportunity to request input on how extended formatting for inactive windows could/should occur. Currently it's only possible to separately format info (number, flags, title) for the active window.

Usage? Add 'T' as a flag for the 'w' or 'W' escape in the hardstatus. Note: must be put after any other possible flags (-/+/L).

Keep in mind this was for personal use and as an jumping off point for extending formatting possibilities (truly prio one huh? :). I don't see this flag-approach with hardcoded formatting working in the long run. Anyway, here's the diff (also attached):

diff -Naur original/screen-4.0.3/screen.c screen-4.0.3/screen.c
--- original/screen-4.0.3/screen.c 2011-11-30 04:37:28.000000000 +0100
+++ screen-4.0.3/screen.c 2011-11-30 05:02:51.000000000 +0100
@@ -2025,11 +2025,11 @@
static const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
#endif

-static char winmsg_buf[MAXSTR];
+char winmsg_buf[MAXSTR];
#define MAX_WINMSG_REND 256 /* rendition changes */
-static int winmsg_rend[MAX_WINMSG_REND];
-static int winmsg_rendpos[MAX_WINMSG_REND];
-static int winmsg_numrend;
+int winmsg_rend[MAX_WINMSG_REND];
+int winmsg_rendpos[MAX_WINMSG_REND];
+int winmsg_numrend;

static char *
pad_expand(buf, p, numpad, padlen)
@@ -2294,6 +2294,7 @@
int longflg;
int minusflg;
int plusflg;
+ int btitlesflg;
int qmflag = 0, omflag = 0, qmnumrend = 0;
char *qmpos = 0;
int numpad = 0;
@@ -2356,6 +2357,8 @@
num = num * 10 + (*s++ - '0');
if ((longflg = *s == 'L') != 0)
s++;
+ if ((btitlesflg = *s == 'T') != 0)
+ s++;
switch (*s)
{
case '?':
@@ -2528,7 +2531,7 @@
oldfore = D_fore;
D_fore = win;
}
- ss = AddWindows(p, l - 1, (*s == 'w' ? 0 : 1) | (longflg ? 0 : 2) | (plusflg ? 4 : 0), win ? win->w_number : -1);
+ ss = AddWindows(p, l - 1, (*s == 'w' ? 0 : 1) | (longflg ? 0 : 2) | (plusflg ? 4 : 0) | (minusflg ? 8 : 0) | (btitlesflg ? 16 : 0), win ? win->w_number : -1);
if (minusflg)
*ss = 0;
if (display)
diff -Naur original/screen-4.0.3/process.c screen-4.0.3/process.c
--- original/screen-4.0.3/process.c 2011-11-30 04:37:28.000000000 +0100
+++ screen-4.0.3/process.c 2011-11-30 04:58:32.000000000 +0100
@@ -4742,6 +4742,12 @@
int flags;
int where;
{
+ // MA: alt. pass (strlen(winmsg_buf) - strlen(p)) as buf offset
+ extern char winmsg_buf[];
+ // MA: could / should we use ApplyAttrColor() / SetRendition() instead?
+ extern int winmsg_rend[];
+ extern int winmsg_rendpos[];
+ extern int winmsg_numrend;
register char *s, *ss;
register struct win **pp, *p;
register char *cmd;
@@ -4781,6 +4787,16 @@
s = AddWindowFlags(s, len, p);
}
*s++ = ' ';
+ if (flags & 16 && ((!(flags & 8)) ? : p->w_number < where))
+ {
+ // MA: feels safe atm, but winmsg_rendpos[] must be in asc. order
+ winmsg_rend[winmsg_numrend] = 1024; // %{+b}
+ winmsg_rendpos[winmsg_numrend] = strlen(winmsg_buf) - strlen(s);
+ winmsg_numrend++;
+ winmsg_rend[winmsg_numrend] = -1; // %{-}
+ winmsg_rendpos[winmsg_numrend] = l + strlen(winmsg_buf) - strlen(s);
+ winmsg_numrend++;
+ }
strncpy(s, cmd, l);
s += l;
}

---
Over and out,
Mattias Ahlbäck

Attachment: screen-4.0.3-bold-titles.patch
Description: Binary data


reply via email to

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