nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 6ce4e3ede85b91bfd2f350f22014852298fc9f57
parent 287718cf8b9f9b254add71f22b574c2a84a501a0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 19 Jun 2020 09:54:57 +0200

feedback: do not list "." and ".." as possible <Tab><Tab> completions

The single dot serves no purpose, as the user is already there.  And
the double dot is reached more easily by typing a second dot first.

And anyway, . and .. are not shown when the user does not type a dot
first, so why show them when the user types a single dot followed by
<Tab><Tab>?  Most likely the user wants to see actual dot files, so
just show those.

This fixes https://savannah.gnu.org/bugs/?58619.

Diffstat:
Msrc/files.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -2451,8 +2451,8 @@ char **filename_completion(const char *buf, size_t length, * and add each fitting one to the list of matches. */ while ((nextdir = readdir(dir)) != NULL) { if (strncmp(nextdir->d_name, filename, filenamelen) == 0 && - (*filename == '.' || (strcmp(nextdir->d_name, ".") != 0 && - strcmp(nextdir->d_name, "..") != 0))) { + strcmp(nextdir->d_name, ".") != 0 && + strcmp(nextdir->d_name, "..") != 0) { char *fullname = charalloc(strlen(dirname) + strlen(nextdir->d_name) + 1); sprintf(fullname, "%s%s", dirname, nextdir->d_name);