about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-02-28 13:59:10 +0100
committerOliver Kiddle <opk@zsh.org>2024-02-28 13:59:10 +0100
commit69c58874611a586c68be14ce7965029dc00f41b7 (patch)
treed56b7d3e64ce6623dff85e784826e501a213a22a
parent3078e07729930bfbff647b9b63452b58a54ecc70 (diff)
downloadzsh-69c58874611a586c68be14ce7965029dc00f41b7.tar.gz
zsh-69c58874611a586c68be14ce7965029dc00f41b7.tar.xz
zsh-69c58874611a586c68be14ce7965029dc00f41b7.zip
52622 (tweaked, c.f. 52626): adjust number of columns and drop right-parenthesis in "kill -L" output
-rw-r--r--ChangeLog3
-rw-r--r--Src/jobs.c15
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7aaadfeb3..e836a3853 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2024-02-28  Oliver Kiddle  <opk@zsh.org>
 
+	* 52622 (tweaked, c.f. 52626): Src/jobs.c: adjust number of columns
+	and drop right-parenthesis in "kill -L" output
+
 	* 52623: Src/signames2.awk: add some Solaris signal descriptions
 
 2024-02-28  Oliver Kiddle  <opk@zsh.org>
diff --git a/Src/jobs.c b/Src/jobs.c
index 49decc661..07facc60b 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2822,23 +2822,26 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 #else
 		const int width = SIGCOUNT >= 100 ? 3 : 2;
 #endif
+		const int cols = zterm_columns >= 30 ?
+		    (zterm_columns < 90 ? zterm_columns / 15 : 6) : 1;
+
 		for (sig = 1; sig < SIGCOUNT
 #if defined(SIGRTMIN) && defined(SIGRTMAX)
 			+ 1
 #endif
 			; sig++)
 		{
-		    printf("%*d) %-10s%c", width, sig, sigs[sig],
-			    sig % 5 ? ' ' : '\n');
+		    printf("%*d %-10s%c", width, sig, sigs[sig],
+			    sig % cols ? ' ' : '\n');
 		}
 #if defined(SIGRTMIN) && defined(SIGRTMAX)
 		for (sig = SIGRTMIN; sig < SIGRTMAX; sig++) {
-		    printf("%*d) %-10s%c", width, sig, rtsigname(sig, 0),
-			    (sig - SIGRTMIN + SIGCOUNT + 1) % 5 ? ' ' : '\n');
+		    printf("%*d %-10s%c", width, sig, rtsigname(sig, 0),
+			    (sig - SIGRTMIN + SIGCOUNT + 1) % cols ? ' ' : '\n');
 		}
-		printf("%*d) RTMAX\n", width, sig);
+		printf("%*d RTMAX\n", width, sig);
 #else
-		printf("%*d) %s\n", width, sig, sigs[sig]);
+		printf("%*d %s\n", width, sig, sigs[sig]);
 #endif
 		return 0;
 	    }