NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/53985: libedit: file name completion for ..



>Number:         53985
>Category:       lib
>Synopsis:       libedit: file name completion for ..
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 16 07:20:00 +0000 2019
>Originator:     Arto Huusko
>Release:        
>Organization:
>Environment:
>Description:
libedit filecomplete functionality should complete ".." into "../"

Not all shells do this, but many do. It speeds up directory traversal a lot with keyboard mappings where / is hard to type.
>How-To-Repeat:
in sh prompt write cd .. and press tab.
>Fix:
patch for libedit/filecomplete.c:

@@ -343,9 +343,10 @@
 	/* find the match */
 	while ((entry = readdir(dir)) != NULL) {
 		/* skip . and .. */
-		if (entry->d_name[0] == '.' && (!entry->d_name[1]
-		    || (entry->d_name[1] == '.' && !entry->d_name[2])))
-			continue;
+		if (entry->d_name[0] == '.' && !entry->d_name[1])
+            continue;
+        if (entry->d_name[0] == '.' && entry->d_name[1] == '.' && !entry->d_name[2] && filename_len == 0)
+            continue;
 		if (filename_len == 0)
 			break;
 		/* otherwise, get first entry where first */



Home | Main Index | Thread Index | Old Index