ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] gselect and empty response


From: Ali Gholami Rudi
Subject: [RP] gselect and empty response
Date: Mon, 11 Feb 2008 15:30:44 +0330
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi:

Currently RP switches to the first group when an empty group name is
given to gselect.  I think it is a better idea to go to the last
group, instead.

This patch merely saves the name of the last group.  It fails if the
last group has been removed.  But handling that case requires
maintaining a list which does not seem to worth it.  Hope someone
finds it useful.

Regards,
Ali

diff --git a/src/actions.c b/src/actions.c
--- a/src/actions.c
+++ b/src/actions.c
@@ -4751,8 +4751,12 @@
 cmd_gselect (int interactive, struct cmdarg **args)
 {
   rp_group *g;
-
-  g = find_group (ARG_STRING(0));
+  char* arg;
+
+  arg = ARG_STRING(0);
+  if (strlen (arg) == 0 && rp_last_group_name != NULL)
+    arg = rp_last_group_name;
+  g = find_group (arg);
 
   if (g)
     set_current_group (g);
diff --git a/src/globals.c b/src/globals.c
--- a/src/globals.c
+++ b/src/globals.c
@@ -55,6 +55,8 @@
 rp_screen *screens;
 int num_screens;
 Display *dpy;
+
+char* rp_last_group_name;
 
 rp_group *rp_current_group;
 LIST_HEAD (rp_groups);
diff --git a/src/globals.h b/src/globals.h
--- a/src/globals.h
+++ b/src/globals.h
@@ -55,6 +55,9 @@
 
 /* The list of groups. */
 extern struct list_head rp_groups;
+
+/* The name of the last selected group */
+extern char *rp_last_group_name;
 
 extern rp_group *rp_current_group;
 
diff --git a/src/group.c b/src/group.c
--- a/src/group.c
+++ b/src/group.c
@@ -504,6 +504,8 @@
   if (rp_current_group == g || g == NULL)
     return;
 
+  if (rp_current_group)
+    rp_last_group_name = rp_current_group->name;
   rp_current_group = g;
 
   /* Call the switch group hook. */




reply via email to

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