summaryrefslogtreecommitdiff
path: root/bin/ksh/emacs.c
diff options
context:
space:
mode:
authorCamiel Dobbelaar <camield@cvs.openbsd.org>2001-07-17 12:39:32 +0000
committerCamiel Dobbelaar <camield@cvs.openbsd.org>2001-07-17 12:39:32 +0000
commitec122b4bb36929fda46a5a9aacb38bfef04bf8fd (patch)
treeb1994d9a4b7511b697131c831231e41403d27742 /bin/ksh/emacs.c
parenta29e4b0580797a08bb1568855dac0cbfb1ee60df (diff)
make file-completion work with ~ (tilde)
tested by provos@ and me
Diffstat (limited to 'bin/ksh/emacs.c')
-rw-r--r--bin/ksh/emacs.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c
index 5864be51940..e0643e7ebf0 100644
--- a/bin/ksh/emacs.c
+++ b/bin/ksh/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.14 2001/02/19 09:49:52 camield Exp $ */
+/* $OpenBSD: emacs.c,v 1.15 2001/07/17 12:39:31 camield Exp $ */
/*
* Emacs-like command line editing and history
@@ -1798,15 +1798,15 @@ do_complete(flags, type)
olen = end - start;
nlen = x_longest_prefix(nwords, words);
- /* complete single match, or multi-match without globbing chars */
- if ((nlen > olen) &&
- ((nwords == 1) || (strncmp(words[0], xbuf + start, olen) == 0))) {
- x_goto(xbuf + start);
- x_delete(olen, FALSE);
- x_escape(words[0], nlen, x_emacs_putbuf);
- x_adjust();
- completed = 1;
+ /* complete */
+ if (nlen > olen) {
+ x_goto(xbuf + start);
+ x_delete(olen, FALSE);
+ x_escape(words[0], nlen, x_emacs_putbuf);
+ x_adjust();
+ completed = 1;
}
+ /* add space if single non-dir match */
if ((nwords == 1) && (!ISDIRSEP(words[0][nlen - 1]))) {
x_ins(space);
completed = 1;