Commit 0fbedf049b2edf5111beabf74308bf096e145320
- Date: Fri Apr 18 17:52:47 +0000 2008
- Committer: Tim Harper (timcharper@gmail.com)
- Author: Tim Harper (timcharper@gmail.com)
- Commit SHA1: 0fbedf049b2edf5111beabf74308bf096e145320
- Tree SHA1: de3cdee3b35503ebb97fc0407767726557e88a06
go to file - ability to specify a full-path with a filename was broken somewhere along the way.
Commit diff
Commands/Go to file.tmCommand
| |   |
| 18 | 18 | ).strip |
| 19 | 19 | |
| 20 | 20 | filepath = TextMate::UI.request_string(:title => "Go to file", :prompt => "Enter a filename with path", :default => "" ) if filepath.empty? |
| 21 | | |
| 21 | |
| 22 | 22 | if filepath.nil? || filepath.empty? |
| 23 | 23 | puts "Canceled" |
| 24 | 24 | exit_show_tool_tip |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | | |
| 28 | | if /^\//.match(filepath) && File.exists?(filepath) |
| 29 | | tm_open(filepath) |
| 30 | | exit_show_tool_tip |
| 31 | | end |
| 32 | | |
| 33 | 27 | line = nil |
| 34 | 28 | if /^(.+):(\d+)$/.match(filepath) |
| 35 | 29 | filepath = $1 |
| 36 | 30 | line = $2 |
| 37 | 31 | end |
| 32 | |
| 33 | if /^\//.match(filepath) && File.exists?(filepath) |
| 34 | tm_open(filepath, :line => line) |
| 35 | exit_show_tool_tip |
| 36 | end |
| 37 | |
| 38 | 38 | |
| 39 | 39 | filepath.gsub!(/\.{1,2}\//, "") |
| 40 | 40 | filepath.gsub!(/^\//, "") # remove the beginning slash |
| toggle raw diff |
--- a/Commands/Go to file.tmCommand
+++ b/Commands/Go to file.tmCommand
@@ -18,23 +18,23 @@ filepath = tm_expanded_selection(
).strip
filepath = TextMate::UI.request_string(:title => "Go to file", :prompt => "Enter a filename with path", :default => "" ) if filepath.empty?
-
+
if filepath.nil? || filepath.empty?
puts "Canceled"
exit_show_tool_tip
end
-
-if /^\//.match(filepath) && File.exists?(filepath)
- tm_open(filepath)
- exit_show_tool_tip
-end
-
line = nil
if /^(.+):(\d+)$/.match(filepath)
filepath = $1
line = $2
end
+
+if /^\//.match(filepath) && File.exists?(filepath)
+ tm_open(filepath, :line => line)
+ exit_show_tool_tip
+end
+
filepath.gsub!(/\.{1,2}\//, "")
filepath.gsub!(/^\//, "") # remove the beginning slash |