diff --git a/screen.changes b/screen.changes index 24aa451..b4c0c95 100644 --- a/screen.changes +++ b/screen.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 25 13:11:20 UTC 2012 - trenn@suse.de + +- Fix sort command to not stop at window gaps. + That can happen if windows got deleted and the window numbers do not + increment sequentially anymore. + ------------------------------------------------------------------- Tue Oct 9 07:47:52 UTC 2012 - lnt-sysadmin@lists.lrz.de diff --git a/sort_command.patch b/sort_command.patch index 50bbfea..16906a1 100644 --- a/sort_command.patch +++ b/sort_command.patch @@ -1,5 +1,13 @@ ---- ./comm.c.orig 2012-06-08 15:20:17.000000000 +0000 -+++ ./comm.c 2012-06-08 16:03:10.000000000 +0000 +--- + comm.c | 1 + + doc/screen.1 | 5 +++++ + process.c | 43 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 49 insertions(+) + +Index: comm.c +=================================================================== +--- comm.c.orig ++++ comm.c @@ -297,6 +297,7 @@ struct comm comms[RC_LAST + 1] = { "sleep", ARGS_1 }, { "slowpaste", NEED_FORE|ARGS_01 }, @@ -8,8 +16,10 @@ { "source", ARGS_1 }, { "split", NEED_DISPLAY|ARGS_01 }, { "startup_message", ARGS_1 }, ---- ./doc/screen.1.orig 2012-06-08 16:02:58.000000000 +0000 -+++ ./doc/screen.1 2012-06-08 16:03:10.000000000 +0000 +Index: doc/screen.1 +=================================================================== +--- doc/screen.1.orig ++++ doc/screen.1 @@ -3015,6 +3015,11 @@ underlying system exposes flow control p text. .sp @@ -22,9 +32,11 @@ .BI "source " file .PP Read and execute commands from file \fIfile\fP. Source commands may ---- ./process.c.orig 2012-06-08 15:20:18.000000000 +0000 -+++ ./process.c 2012-06-08 16:03:10.000000000 +0000 -@@ -3024,6 +3024,47 @@ int key; +Index: process.c +=================================================================== +--- process.c.orig ++++ process.c +@@ -3024,6 +3024,49 @@ int key; } } break; @@ -38,32 +50,34 @@ + "and try again\n"); + break; + } -+ i = 0; -+ if (!wtab[i] || !wtab[i+1]) ++ /* ++ * Simple sort algorithm: Look out for the smallest, put it ++ * to the first place, look out for the 2nd smallest, ... ++ */ ++ for (i = 0; i < maxwin ; i++) + { -+ Msg(0, "Less than two windows, sorting makes no sense.\n"); -+ break; -+ } -+ for (i = 0; wtab[i+1] != NULL; i++) -+ { -+ for (n = i, nr = i; wtab[n+1] != NULL; n++) ++ if (wtab[i] == NULL) ++ continue; ++ n = i; ++ for (nr = i + 1; nr < maxwin; nr++) + { -+ if (strcmp(wtab[nr]->w_title,wtab[n+1]->w_title) > 0) -+ { -+ nr = n+1; -+ } ++ if (wtab[nr] == NULL) ++ continue; ++ debug2("Testing window %d and %d.\n", nr, n); ++ if (strcmp(wtab[nr]->w_title,wtab[n]->w_title) < 0) ++ n = nr; + } -+ if (nr != i) ++ if (n != i) + { -+ debug2("Exchange window %d and %d.\n", i, nr); -+ p = wtab[nr]; -+ wtab[nr] = wtab[i]; -+ wtab[i] = p; -+ wtab[nr]->w_number = nr; -+ wtab[i]->w_number = i; ++ debug2("Exchange window %d and %d.\n", i, n); ++ p = wtab[n]; ++ wtab[n] = wtab[i]; ++ wtab[i] = p; ++ wtab[n]->w_number = n; ++ wtab[i]->w_number = i; +#ifdef MULTIUSER -+ /* exchange the acls for these windows. */ -+ AclWinSwap(i, nr); ++ /* exchange the acls for these windows. */ ++ AclWinSwap(i, n); +#endif + } + }