Skip to content

Commit

Permalink
revert ad45f0e, which breaks :CommandT with a path argument
Browse files Browse the repository at this point in the history
Signed-off-by: Wincent Colaiuta <win@wincent.com>
  • Loading branch information
garybernhardt authored and wincent committed Feb 29, 2012
1 parent bcd3914 commit fc5b5c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
12 changes: 11 additions & 1 deletion ruby/command-t/controller.rb
Expand Up @@ -214,6 +214,13 @@ def get_list_or_string name
end
end

# Backslash-escape space, \, |, %, #, "
def sanitize_path_string str
# for details on escaping command-line mode arguments see: :h :
# (that is, help on ":") in the Vim documentation.
str.gsub(/[ \\|%#"]/, '\\\\\0')
end

def default_open_command
if !get_bool('&hidden') && get_bool('&modified')
'sp'
Expand Down Expand Up @@ -244,8 +251,11 @@ def ensure_appropriate_window_selection

def open_selection selection, options = {}
command = options[:command] || default_open_command

selection = File.expand_path selection, @path
selection = relative_path_under_working_directory selection
selection = sanitize_path_string selection
ensure_appropriate_window_selection

@active_finder.open_selection command, selection, options
end

Expand Down
14 changes: 0 additions & 14 deletions ruby/command-t/finder.rb
Expand Up @@ -22,7 +22,6 @@
# POSSIBILITY OF SUCH DAMAGE.

require 'command-t/ext' # CommandT::Matcher
require 'command-t/vim/path_utilities'

module CommandT
# Encapsulates a Scanner instance (which builds up a list of available files
Expand All @@ -49,24 +48,11 @@ def flush
end

def open_selection command, selection, options = {}
selection = File.expand_path selection, @path
selection = relative_path_under_working_directory selection
selection = sanitize_path_string selection

::VIM::command "silent #{command} #{selection}"
end

def path= path
@scanner.path = path
end

private

# Backslash-escape space, \, |, %, #, "
def sanitize_path_string str
# for details on escaping command-line mode arguments see: :h :
# (that is, help on ":") in the Vim documentation.
str.gsub(/[ \\|%#"]/, '\\\\\0')
end
end # class Finder
end # CommandT

0 comments on commit fc5b5c3

Please sign in to comment.