From 7d33372d20aa643eb5bc431d4e0e17d5fca1af40 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 20 May 2018 14:35:51 -0500 Subject: [PATCH] Fix __fish_complete_suffix behavior per __fish_complete_directories test --- share/functions/__fish_complete_suffix.fish | 5 ++++- tests/__fish_complete_directories.in | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish index 2b28f29ab..0c60ae274 100644 --- a/share/functions/__fish_complete_suffix.fish +++ b/share/functions/__fish_complete_suffix.fish @@ -69,7 +69,10 @@ function __fish_complete_suffix -d "Complete using files" # term a "bug" per-se. if test $files[1] - printf "%s\t$desc\n" $files | sort -u + if not string match -q -- "$desc" "" + set -l desc "\t$desc" + end + printf "%s$desc\n" $files | sort -u end end diff --git a/tests/__fish_complete_directories.in b/tests/__fish_complete_directories.in index 4a98fce17..c6769a383 100644 --- a/tests/__fish_complete_directories.in +++ b/tests/__fish_complete_directories.in @@ -1,10 +1,10 @@ cd .. -mkdir test/data/abc -mkdir test/data/abcd +mkdir -p test/data/abc +mkdir -p test/data/abcd touch test/data/af touch test/data/abcdf -mkdir test/data/xy -mkdir test/data/xyz +mkdir -p test/data/xy +mkdir -p test/data/xyz touch test/data/xyf touch test/data/xyzf echo \# __fish_complete_directories test/z