]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
Readline-8.2 patch 9: fix issue where directory name being completed needs both tilde...
authorChet Ramey <chet.ramey@case.edu>
Sun, 14 Jan 2024 20:20:44 +0000 (15:20 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sun, 14 Jan 2024 20:20:44 +0000 (15:20 -0500)
complete.c
patchlevel

index e5d224ed040e71b6405846e651d694bacffb9663..c9e009838248a44870d1e42a874f6dd3feb2a20d 100644 (file)
@@ -2526,7 +2526,8 @@ rl_filename_completion_function (const char *text, int state)
          temp = tilde_expand (dirname);
          xfree (dirname);
          dirname = temp;
-         tilde_dirname = 1;
+         if (*dirname != '~')
+           tilde_dirname = 1;  /* indicate successful tilde expansion */
        }
 
       /* We have saved the possibly-dequoted version of the directory name
@@ -2545,11 +2546,16 @@ rl_filename_completion_function (const char *text, int state)
          xfree (users_dirname);
          users_dirname = savestring (dirname);
        }
-      else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function)
+      else if (rl_completion_found_quote && rl_filename_dequoting_function)
        {
-         /* delete single and double quotes */
+         /* We already ran users_dirname through the dequoting function.
+            If tilde_dirname == 1, we successfully performed tilde expansion
+            on dirname. Now we need to reconcile those results. We either
+            just copy the already-dequoted users_dirname or tilde expand it
+            if we tilde-expanded dirname. */
+         temp = tilde_dirname ? tilde_expand (users_dirname) : savestring (users_dirname);
          xfree (dirname);
-         dirname = savestring (users_dirname);
+         dirname = temp;
        }
       directory = opendir (dirname);
 
index 6c10f126a3ec0693ae873faa07e809054b8f6ece..c0ac809966bd8b12359e877858fdd128220c94ef 100644 (file)
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
 
-8
+9