Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit Only quote the completion matches if we are doin...
details: https://anonhg.NetBSD.org/src/rev/8e9673c385bf
branches: trunk
changeset: 840121:8e9673c385bf
user: abhinav <abhinav%NetBSD.org@localhost>
date: Sun Mar 24 16:42:49 2019 +0000
description:
Only quote the completion matches if we are doing filename completion
If the user supplies a value for the attempted_completion_function parameter
then we cannot be sure if the completion is for filename or something else, in such
a case don't attempt to quote the completion matches.
Reviewed by christos
This should address PR lib/54067
diffstat:
lib/libedit/filecomplete.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (43 lines):
diff -r 5348c6987555 -r 8e9673c385bf lib/libedit/filecomplete.c
--- a/lib/libedit/filecomplete.c Sun Mar 24 16:39:46 2019 +0000
+++ b/lib/libedit/filecomplete.c Sun Mar 24 16:42:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filecomplete.c,v 1.51 2018/05/04 20:38:26 christos Exp $ */
+/* $NetBSD: filecomplete.c,v 1.52 2019/03/24 16:42:49 abhinav Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.51 2018/05/04 20:38:26 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.52 2019/03/24 16:42:49 abhinav Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -655,15 +655,19 @@
* it, unless we do filename completion and the
* object is a directory. Also do necessary escape quoting
*/
- char *escaped_completion = escape_filename(el, matches[0]);
- if (escaped_completion == NULL)
+ char *completion;
+ if (!attempted_completion_function)
+ completion = escape_filename(el, matches[0]);
+ else
+ completion = strdup(matches[0]);
+ if (completion == NULL)
goto out;
el_winsertstr(el,
- ct_decode_string(escaped_completion, &el->el_scratch));
+ ct_decode_string(completion, &el->el_scratch));
el_winsertstr(el,
- ct_decode_string((*app_func)(escaped_completion),
+ ct_decode_string((*app_func)(completion),
&el->el_scratch));
- free(escaped_completion);
+ free(completion);
} else {
/*
* Only replace the completed string with common part of
Home |
Main Index |
Thread Index |
Old Index