changeset 11512:d32a62babf5f v8.0.0639

patch 8.0.0639: the cursor position is set when editing a new commit message commit https://github.com/vim/vim/commit/9a48961d8bd7ffea14330b9b0181a6cdbe9288f7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 13 16:12:51 2017 +0200 patch 8.0.0639: the cursor position is set when editing a new commit message Problem: The cursor position is set to the last position in a new commit message. Solution: Don't set the position if the filetype matches "commit". (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Jun 2017 16:15:03 +0200
parents d0ec98a59c07
children f38a60ea8c05
files runtime/defaults.vim src/version.c
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/defaults.vim
+++ b/runtime/defaults.vim
@@ -1,7 +1,7 @@
 " The default vimrc file.
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last change:	2017 Apr 12
+" Last change:	2017 Jun 13
 "
 " This is loaded if no vimrc file was found.
 " Except when Vim is run with "-u NONE" or "-C".
@@ -106,12 +106,13 @@ if has("autocmd")
     au!
 
     " When editing a file, always jump to the last known cursor position.
-    " Don't do it when the position is invalid or when inside an event handler
-    " (happens when dropping a file on gvim).
+    " Don't do it when the position is invalid, when inside an event handler
+    " (happens when dropping a file on gvim) and for a commit message (it's
+    " likely a different one than last time).
     autocmd BufReadPost *
-      \ if line("'\"") >= 1 && line("'\"") <= line("$") |
-      \   exe "normal! g`\"" |
-      \ endif
+      \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
+      \ |   exe "normal! g`\""
+      \ | endif
 
   augroup END
 
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    639,
+/**/
     638,
 /**/
     637,