summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/complist.c6
-rw-r--r--Test/Y01completion.ztst15
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e3628cfa7..adea4a078 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-01-04  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* dana: 42164: Src/Zle/complist.c, Test/Y01completion.ztst:
+	numeric values didn't work in format escapes in completion lists.
+
 	* Stephane: 42159: Src/params.c: avoid crash copying empty hash table.
 
 	* Sebastian: 42188: Src/Modules/system.c: It is necessary to
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index a83daeff9..e768aee5d 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1097,6 +1097,9 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
 	    if (*p) {
 		int arg = 0, is_fg;
 
+		if (idigit(*p))
+		    arg = zstrtol(p, &p, 10);
+
 		len = MB_METACHARLENCONV(p, &cchar);
 #ifdef MULTIBYTE_SUPPORT
 		if (cchar == WEOF)
@@ -1104,9 +1107,6 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
 #endif
 		p += len;
 
-		if (idigit(*p))
-		    arg = zstrtol(p, &p, 10);
-
 		m = 0;
 		switch (cchar) {
 		case ZWC('%'):
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 113a45076..b1c0e40e5 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -56,6 +56,21 @@
 >FI:{file1}
 >FI:{file2}
 
+  # Temporarily modify format set in comptest
+  comptesteval 'zstyle -s ":completion:*:descriptions" format oldfmt'
+  comptesteval 'zstyle ":completion:*:descriptions" format \
+    ${oldfmt/>*</>%5F123abc%f %B123abc%b<}'
+  comptest $': \t'
+  comptesteval 'zstyle ":completion:*:descriptions" format $oldfmt'
+0:custom description with formatting sequences
+>line: {: }{}
+*>DESCRIPTION:{*123abc*123abc*~*F123*}
+>DI:{dir1}
+>DI:{dir2}
+>FI:{file1}
+>FI:{file2}
+F:regression test workers/42164
+
 # Depends on path assignment in comptestinit
   comptesteval "path=( $ZTST_srcdir:A )"
   comptest $'zt\t'