From 6e84b7ceb7f899a4754f8c1ab32a36a400dc3831 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 25 Mar 2015 23:29:16 +0100 Subject: [PATCH] fix GotoDiff when no file path is found Git manual hunk editing files identify as diff, but lack the file path. For manual hunk ediiting, it's also useful to use the default Enter behavior, so we fall back to it if no file path is found. --- diff.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/diff.py b/diff.py index bbac877a..361aeff2 100644 --- a/diff.py +++ b/diff.py @@ -141,7 +141,11 @@ def run(self, edit): else: git_root_dir = "" - if not os.path.isfile(full_path_file_name): + if full_path_file_name is None + # If no path exists, this is a manual hunk editing diff + # fall back to default "Enter" command + self.view.run_command('insert', {'characters':'\n'}) + elif not os.path.isfile(full_path_file_name): caption = "Enter base directory for file '%s':" % self.file_name v.window().show_input_panel(caption, git_root_dir,