about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2021-06-06 13:56:00 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2021-06-06 13:56:00 +0200
commit9b6b7aba74c43132ab0c25ab0e755515a32d1252 (patch)
tree94c9ee63706fc1bc9940d11b08998b05dd1d8152
parentf5b25683b6125ffd3733db6ce21c468ea28b03d8 (diff)
completion: also match paths containing a ~ character
Currently, the tilde character is not replaced by $HOME in the file name
which may cause issues with application not expanding tilde themselves.
-rw-r--r--saneterm/completion.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/saneterm/completion.py b/saneterm/completion.py
index c9e29b7..0eaaa48 100644
--- a/saneterm/completion.py
+++ b/saneterm/completion.py
@@ -61,6 +61,11 @@ class FileName():
         self.__cwd = cwd
 
     def get_matches(self, input):
+        # Preferably, we would expand ~ to $HOME on tab since the
+        # application may not expand ~ itself. However, the current
+        # completion setup just allows appending characters to the end.
+        input = os.path.expanduser(input)
+
         if input.find("/") != -1:
             base = os.path.dirname(input)
             prefix = os.path.basename(input)