From 775b15d53601ff6f38ddd3ec50f6710619c5d9e4 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. Fixes #407 --- diff.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/diff.py b/diff.py index bbac877a..a6ff8789 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 + v.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,