Closed rkuchumov closed 4 years ago
Can probably fix this, although it might be the kind of thing that is very susceptible to platform differences. I also wonder how sane it is to create/use files with newlines in their names. Do you really have such files in your use case?
Something like this will probably do it; works for me locally at least. Care to try it on your system @rkuchumov?
diff --git a/ruby/command-t/lib/command-t/controller.rb b/ruby/command-t/lib/command-t/controller.rb
index 6f0187b..ebded6a 100644
--- a/ruby/command-t/lib/command-t/controller.rb
+++ b/ruby/command-t/lib/command-t/controller.rb
@@ -416,7 +416,7 @@ def case_sensitive?
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')
+ str.gsub(/[ \n\\|%#"]/, '\\\\\0')
end
def current_buffer_visible_in_other_window
Probably a better/safer fix:
diff --git a/ruby/command-t/lib/command-t/controller.rb b/ruby/command-t/lib/command-t/controller.rb
index 6f0187b..0323d54 100644
--- a/ruby/command-t/lib/command-t/controller.rb
+++ b/ruby/command-t/lib/command-t/controller.rb
@@ -412,11 +412,9 @@ def case_sensitive?
false
end
- # Backslash-escape space, \, |, %, #, "
+ # Backslash-escape space, \, |, %, #, " etc.
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')
+ ::VIM::evaluate("fnameescape('#{str}')")
end
def current_buffer_visible_in_other_window
The last one works, thanks! Majority of file systems allow to have any character in the file name except for 0-byte and slash. So files with any control charter may appear in FS.
When I create a file that contains LF:
I can not use command-t to open it:
One of the workaround that I've found is to use
:edit **/*
instead of command-t