[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [screen-devel] Window group code contribution
From: |
Ethan Warth |
Subject: |
Re: [screen-devel] Window group code contribution |
Date: |
Mon, 22 Oct 2018 20:21:16 -0500 |
(I'm resending this, to the mailing list this time. I didn't notice that my
reply wasn't actually going to the list.)
Sorry; your message ended up in my spam folder, and I didn't notice it
immediately.
I will be including the git format-patch (both as inline text in this message
and also as file attachments as a redundancy measure). This is my first time
submitting git patches over email; let me know if I need to make another
attempt at sending the commit patches.
>From d49ecaa67e338125fe691aca512d6bc81e57936b Mon Sep 17 00:00:00 2001
From: Ethan Warth <address@hidden>
Date: Thu, 11 Oct 2018 00:27:24 -0500
Subject: [PATCH 1/3] added persistent bits to window group display options
---
src/list_window.c | 9 ++++++++-
src/window.c | 8 ++++++++
src/window.h | 4 ++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/list_window.c b/src/list_window.c
index 620f706..a6a5d02 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -278,6 +278,8 @@ static int gl_Window_input(ListData *ldata, char
**inp, size_t *len)
case 'm':
/* Toggle MRU-ness */
wdata->order = wdata->order == WLIST_MRU ? WLIST_NUM : WLIST_MRU;
+ if (wdata->group)
+ wdata->group->w_list_mru = wdata->order == WLIST_MRU;
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
break;
@@ -285,6 +287,8 @@ static int gl_Window_input(ListData *ldata, char
**inp, size_t *len)
case 'g':
/* Toggle nestedness */
wdata->nested = !wdata->nested;
+ if (wdata->group)
+ wdata->group->w_list_group = wdata->nested ? true : false;
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
break;
@@ -453,8 +457,11 @@ void display_windows(int onblank, int order, Window *group)
return;
}
- if (group)
+ if (group) {
onblank = 0; /* When drawing a group window, ignore 'onblank' */
+ order = (group->w_list_group ? WLIST_NESTED : 0) +
+ (group->w_list_mru ? 1 : 0); /* also ignore order flags */
+ }
if (onblank) {
if (!display) {
diff --git a/src/window.c b/src/window.c
index e197390..b6d99fb 100644
--- a/src/window.c
+++ b/src/window.c
@@ -95,6 +95,8 @@ struct NewWindow nwin_undef = {
.aflag = false,
.dynamicaka = false,
.flowflag = -1,
+ .list_mru = false,
+ .list_group = false,
.lflag = -1,
.histheight = -1,
.monitor = -1,
@@ -121,6 +123,8 @@ struct NewWindow nwin_default = {
.aflag = false,
.dynamicaka = true,
.flowflag = FLOW_ON,
+ .list_mru = false,
+ .list_group = false,
.lflag = 1,
.histheight = DEFAULTHISTHEIGHT,
.monitor = MON_OFF,
@@ -153,6 +157,8 @@ void nwin_compose(struct NewWindow *def, struct
NewWindow *new, struct NewWindow
COMPOSE(aflag);
COMPOSE(dynamicaka);
COMPOSE(flowflag);
+ COMPOSE(list_mru);
+ COMPOSE(list_group);
COMPOSE(lflag);
COMPOSE(histheight);
COMPOSE(monitor);
@@ -556,6 +562,8 @@ int MakeWindow(struct NewWindow *newwin)
p->w_savelayer = &p->w_layer;
p->w_pdisplay = NULL;
p->w_lastdisp = NULL;
+ p->w_list_mru = nwin.list_mru;
+ p->w_list_group = nwin.list_group;
if (display && !AclCheckPermWin(D_user, ACL_WRITE, p))
p->w_wlockuser = D_user;
diff --git a/src/window.h b/src/window.h
index e6faaee..8989de3 100644
--- a/src/window.h
+++ b/src/window.h
@@ -50,6 +50,8 @@ struct NewWindow {
bool aflag;
bool dynamicaka;
int flowflag;
+ bool list_mru; /* MRU list order for window groups */
+ bool list_group; /* show nested children in window groups */
int lflag;
int histheight;
int monitor;
@@ -139,6 +141,8 @@ struct Window {
Window *w_next; /* next window */
Window *w_prev_mru; /* previous most recently used window */
int w_type; /* type of window */
+ bool w_list_mru; /* MRU list order for window groups */
+ bool w_list_group; /* show nested children in window groups */
Layer w_layer; /* our layer */
Layer *w_savelayer; /* the layer to keep */
int w_blocked; /* block input */
--
2.17.0
>From b88450f495a4aa61964c531b07fb599db07f01e1 Mon Sep 17 00:00:00 2001
From: Ethan Warth <address@hidden>
Date: Thu, 11 Oct 2018 01:52:17 -0500
Subject: [PATCH 2/3] added function and key binding for traversing to parent
---
src/comm.c | 1 +
src/process.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/src/comm.c b/src/comm.c
index 2eeea5d..510850a 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -159,6 +159,7 @@ struct comm comms[RC_LAST + 1] =
{ "obuflimit", NEED_DISPLAY|ARGS_01, {NULL} },
{ "only", NEED_DISPLAY|ARGS_0, {NULL} },
{ "other", ARGS_0, {NULL} },
+ { "parent", ARGS_0, {NULL} },
{ "partial", NEED_FORE|ARGS_01, {NULL} },
{ "paste", NEED_LAYER|ARGS_012, {NULL} },
{ "pastefont", ARGS_01, {NULL} },
diff --git a/src/process.c b/src/process.c
index 90841b5..984d46c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -74,6 +74,7 @@ static void ClearAction(struct action *);
static void SaveAction(struct action *, int, char **, int *);
static Window *NextWindow(void);
static Window *PreviousWindow(void);
+static Window *ParentWindow(void);
static int MoreWindows(void);
static void CollapseWindowlist(void);
static void LogToggle(bool);
@@ -438,6 +439,7 @@ void InitKeytab(void)
ktab[' '].nr = ktab[Ctrl(' ')].nr = ktab['n'].nr =
ktab[Ctrl('n')].nr = RC_NEXT;
ktab['N'].nr = RC_NUMBER;
ktab[Ctrl('h')].nr = ktab[0177].nr = ktab['p'].nr =
ktab[Ctrl('p')].nr = RC_PREV;
+ ktab['u'].nr = ktab[Ctrl('u')].nr = RC_PARENT;
{
char *args[2];
args[0] = "--confirm";
@@ -1074,6 +1076,20 @@ static void DoCommandPrev(struct action *act)
SwitchWindow(PreviousWindow());
}
+static void DoCommandParent(struct action *act)
+{
+ (void)act; /* unused */
+
+ if (MoreWindows()) {
+ Window *w = ParentWindow();
+ if (w == NULL && fore != NULL)
+ Msg(0, "Window has no parent.");
+ else
+ SwitchWindow(w);
+ }
+
+}
+
static void DoCommandKill(struct action *act)
{
char **args = act->args;
@@ -4738,6 +4754,9 @@ void DoAction(struct action *act)
case RC_PREV:
DoCommandPrev(act);
break;
+ case RC_PARENT:
+ DoCommandParent(act);
+ break;
case RC_KILL:
DoCommandKill(act);
break;
@@ -5844,6 +5863,12 @@ static Window *PreviousWindow(void)
return w;
}
+static Window *ParentWindow(void)
+{
+ Window *w = fore ? fore->w_group : NULL;
+ return w;
+}
+
static int MoreWindows(void)
{
char *m = "No other window.";
--
2.17.0
>From 528f2ba9dda7a7cbd7d6d6a579174606555866d4 Mon Sep 17 00:00:00 2001
From: Ethan Warth <address@hidden>
Date: Thu, 11 Oct 2018 02:31:14 -0500
Subject: [PATCH 3/3] added documentation for traversal to parent group
---
src/doc/screen.1 | 8 ++++++++
src/doc/screen.texinfo | 15 +++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index bb2b45a..d6686c4 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -649,6 +649,14 @@ T};(time);T{
Show system information.
T}
_
+T{
+C-a u,
+.br
+C-a C-u
+T};(parent);T{
+Switch to the parent window.
+T}
+_
C-a v;(version);T{
Display the version and compilation date.
T}
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index 3a27a81..005a0f3 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -753,6 +753,12 @@ Send a ^S (ASCII XOFF) to the current window.
@xref{XON/XOFF}.
(split)@*
Split the current region horizontally into two new ones. @xref{Regions}.
address@hidden @kbd{C-a u}
address@hidden @kbd{C-a C-u}
+(parent)@*
+Switch to the parent window.
address@hidden
+
@item @kbd{C-a v}
(version)@*
Display the version and compilation date. @xref{Version}.
@@ -1118,6 +1124,8 @@ Select output buffer limit. @xref{Obuflimit}.
Kill all other regions. @xref{Regions}.
@item other
Switch to the window you were in last. @xref{Selecting}.
address@hidden parent
+Switch to the parent window. @xref{Selecting}.
@item partial @var{state}
Set window to partial refresh. @xref{Redisplay}.
@item password address@hidden
@@ -1547,6 +1555,13 @@ pressing space.)
Switch to the previous window (the opposite of @kbd{C-a n}).
@end deffn
address@hidden u
address@hidden C-u
address@hidden Command parent
+(@kbd{C-a u}, @kbd{C-a C-u})@*
+Switch to the parent window.
address@hidden deffn
+
@node Other Window, Select, Next and Previous, Selecting
@section Other Window
@kindex C-a
--
2.17.0
Perfect normality is impossible. Be unique!
―redyoshi49q
On Sun, Oct 14, 2018 at 2:34 PM Amadeusz Sławiński <address@hidden> wrote:
>
> On czwartek, 11 października 2018 22:15:37 CEST Ethan Warth wrote:
> > I have made some local changes to the current screen code base ( starting
> > from commit SHA1 ID f606916a7af47167a68806ddb6d471e3847fdafb ), and I would
> > like to contribute these changes to the main project. Specifically, I have
> > made the settings for MRU sorting and recursive display of window group
> > contents persist across redisplays of window groups, and I have added a
> > keybinding (C-a u or C-a C-u) for traversal to the window group containing
> > the current window.
> >
> > I have not signed a contributor license agreement for GNU projects yet, but
> > am willing to sign one.
> >
> > What's the most convenient format to submit the changes? git-format-patch?
> > Something else?
> >
> >
> > Perfect normality is impossible. Be unique!
> > ―redyoshi49q
>
> Hi,
>
> you don't need contributor license agreement to send patches to screen. This
> is required only for GNU packages where all copyrights are assigned to FSF.
>
> Patches made with git format-patch are good.
>
> Cheers,
> Amadeusz
>
>
>
0003-added-documentation-for-traversal-to-parent-group.patch
Description: Source code patch
0001-added-persistent-bits-to-window-group-display-option.patch
Description: Source code patch
0002-added-function-and-key-binding-for-traversing-to-par.patch
Description: Source code patch