about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2021-02-18 21:37:08 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2021-02-18 21:37:08 +0000
commit6bef719302d6db33c63fb6f2636986dff1941ac2 (patch)
treeb11f26ac68fafa5bbd773ed04144d43dcadd14f5
parent9c0533931c51b7d512d3e95850404f5aac2dbce1 (diff)
downloadzsh-6bef719302d6db33c63fb6f2636986dff1941ac2.tar.gz
zsh-6bef719302d6db33c63fb6f2636986dff1941ac2.tar.xz
zsh-6bef719302d6db33c63fb6f2636986dff1941ac2.zip
users/26509: fix for r -L
fc with the -L option should ignore remote entires, rather than
reading them and treating them as an error.
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cbc5eb23b..8eaaee9d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-18  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* users/26509: Src/builtin.c: fc -L should ignore remote entries
+	rather than treat them as an error.
+
 2021-02-17  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 48073: Martijn Dekker: Doc/Zsh/builtins.yo, Src/builtin.c: fc
diff --git a/Src/builtin.c b/Src/builtin.c
index 3093a3056..26335a2e8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1599,8 +1599,9 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 	 * command line to avoid giving the user a nasty turn
 	 * if some helpful soul ran "print -s 'rm -rf /'".
 	 */
-	first = OPT_ISSET(ops,'l')? addhistnum(curhist,-16,0)
-			: addhistnum(curline.histnum,-1,0);
+	int xflags = OPT_ISSET(ops,'L') ? HIST_FOREIGN : 0;
+	first = OPT_ISSET(ops,'l')? addhistnum(curhist,-16,xflags)
+			: addhistnum(curline.histnum,-1,xflags);
 	if (first < 1)
 	    first = 1;
 	if (last < first)