Permalink
Browse files

Moved some functions around

  • Loading branch information...
1 parent eb0cf45 commit ad45f0e4e8c4fcf4b23776813de13a0926cfbefd Noon Silk committed with Dec 5, 2011
Showing with 23 additions and 13 deletions.
  1. +6 −13 ruby/command-t/controller.rb
  2. +17 −0 ruby/command-t/finder.rb
@@ -207,13 +207,6 @@ 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'
@@ -244,14 +237,14 @@ 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
+ # The following has been moved to 'finder.rb'
+ # 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
- # was:
- # ::VIM::command "silent #{command} #{selection}"
end
def map key, function, param = nil
View
@@ -22,6 +22,7 @@
# 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
@@ -48,11 +49,27 @@ def flush
end
def open_selection command, selection, options = {}
+ # Default implementation, children can re-implement this at their leisure.
+
+ 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 ad45f0e

Please sign in to comment.