From a7a83c376c66475a987bd5f1ee0c35ffe2c25e66 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Thu, 17 Aug 2023 13:45:56 +0100 Subject: [PATCH] Fix closing floating preview window When a floating window is closed, the cursor automatically goes back to the original window. There is no need to try to do this ourselves. Fixes #866. --- autoload/gitgutter/hunk.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/gitgutter/hunk.vim b/autoload/gitgutter/hunk.vim index e76cd9b..5993090 100644 --- a/autoload/gitgutter/hunk.vim +++ b/autoload/gitgutter/hunk.vim @@ -248,7 +248,9 @@ function! s:hunk_op(op, ...) let hunk_diff = join(hunk_header + hunk_body, "\n")."\n" - call s:goto_original_window() + if &previewwindow + call s:goto_original_window() + endif call gitgutter#hunk#close_hunk_preview_window() call s:stage(hunk_diff) endif