[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master c091578: TAB completion: disabled directory re
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master c091578: TAB completion: disabled directory removal due to bug |
Date: |
Sun, 16 May 2021 21:18:39 -0400 (EDT) |
branch: master
commit c091578e24bc461dbeaf7b4e3602818b2bc1cf7d
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
TAB completion: disabled directory removal due to bug
Until now, when a different directory has multiple files with the same
base-name, the TAB completion will delete the already-typed directory name
and would only print the matching filename (that may not exist in the
running directory). An example to reproduce the problem is given in the
comments above the code.
To let the TAB completion work for now, with this commit, I have disabled
the part that removes the directory name and we now just simply print the
full file name of matching files. This temporary fix is very ugly (because
long directories get repeated and is not the standard behavior of TAB
completion), but atleast it doesn't delete anything!
---
bin/completion.bash.in | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/bin/completion.bash.in b/bin/completion.bash.in
index da17be2..d418a7b 100644
--- a/bin/completion.bash.in
+++ b/bin/completion.bash.in
@@ -807,9 +807,29 @@ _gnuastro_autocomplete_compreply_options_all(){
# string before saving string (which is standard in autocomplete (the user
# has already given it and it is just annoying!).
_gnuastro_autocomplete_compreply_file(){
- if [ x$1 != x ] && [ -d $1 ]; then COMPREPLY+=("${2#$1}")
- else COMPREPLY+=("$2")
- fi
+
+ # For some reason, when there are multiple matches in a sub-directory,
+ # removing the directory removes the whole thing that the user has
+ # already typed! So the part below (which was the main purpose of this
+ # function is currently commented). Until that bug is fixed, we'll just
+ # return the full file name. Here is how you can reproduce the problem
+ # (with the MAIN FUNCTION below uncommented and the WORK AROUND
+ # commented):
+ #
+ # $ ls
+ # image.fits
+ # $ mkdir subdir
+ # $ mv image.fits subdir/ab-123.fits
+ # $ cp subdir/ab-123.fits subdir/ab-456.fits
+ # $ astcrop subdir/ab-[TAB]
+
+ # MAIN FUNCTION
+ #if [ x$1 != x ] && [ -d $1 ]; then COMPREPLY+=("${2#$1}")
+ #else COMPREPLY+=("$2")
+ #fi
+
+ # WORK AROUND
+ COMPREPLY+=("$2")
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master c091578: TAB completion: disabled directory removal due to bug,
Mohammad Akhlaghi <=