From d25f7fe59eb7a269ff1c3f442eeec82af0eab863 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 13 Jan 2010 04:10:51 +0000 Subject: don't append a space after inserting a completion of a directory (i.e. a path ending in '/') for a slightly better user experience; ok dtucker@ --- usr.bin/ssh/sftp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'usr.bin/ssh/sftp.c') diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index aac92aefc7f..32a3afab43b 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.119 2010/01/13 01:40:16 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.120 2010/01/13 04:10:50 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1736,15 +1736,12 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path, } lf = el_line(el); - /* - * XXX should we really extend here? the user may not be done if - * the filename is a directory. - */ if (g.gl_matchc == 1) { i = 0; if (!terminated) ins[i++] = quote; - if (lastarg || *(lf->cursor) != ' ') + if (*(lf->cursor - 1) != '/' && + (lastarg || *(lf->cursor) != ' ')) ins[i++] = ' '; ins[i] = '\0'; if (i > 0 && el_insertstr(el, ins) == -1) -- cgit v1.2.3