nano

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

commit 133ed4e21dce810418f448d540498232cc604022
parent 53f4a9f5a8113a6da9721f87135bafb5ab627c3d
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Tue, 26 Apr 2016 14:28:01 +0200

tabbing: don't null-terminate a directory name on the slash but after it

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

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

diff --git a/src/files.c b/src/files.c @@ -2675,12 +2675,13 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t *num_matches = 0; null_at(&dirname, buf_len); - /* If there's a / in the name, strip out the directory part. */ + /* If there's a / in the name, split out filename and directory parts. */ slash = strrchr(dirname, '/'); if (slash != NULL) { char *wasdirname = dirname; - filename = mallocstrcpy(NULL, slash + 1); + filename = mallocstrcpy(NULL, ++slash); + /* Cut off the filename part after the slash. */ *slash = '\0'; dirname = real_dir_from_tilde(dirname); free(wasdirname);