From ad35b81343a1f00000c8ebc40ff1efe613597123 Mon Sep 17 00:00:00 2001
From: "wonder.mice" <wonder.mice@gmail.com>
Date: Thu, 6 Sep 2012 00:47:22 +0400
Subject: [PATCH] Fixed tilde expanding in _filedir_xspec

With this patch completions that use _filedir_xspec will not expand
tilde when "expand-tilde" option is set to off.

This patch fixes:

1. What:   vim ~/<TAB>
   Before: vim /home/mice/
   After:  vim ~/

2. What:   vim ~/<TAB><TAB>
   Before: vim /home/mice/
           + list of folders and files
   After:  vim ~/
           + list of folders and files

3. What:   vim ~/Doc
   Before: vim /home/mice/Documents/
   After:  vim ~/Documents/
---
 bash_completion |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bash_completion b/bash_completion
index f3488ba..335f7a3 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1800,7 +1800,7 @@ _filedir_xspec()
     local cur prev words cword
     _init_completion || return
 
-    _expand || return 0
+    _tilde "$cur" || return 0
 
     local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp
     local -a toks
-- 
1.7.9.5

