Skip to content

Commit 9a48961

Browse files
committed
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)
1 parent d738388 commit 9a48961

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

runtime/defaults.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" The default vimrc file.
22
"
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last change: 2017 Apr 12
4+
" Last change: 2017 Jun 13
55
"
66
" This is loaded if no vimrc file was found.
77
" Except when Vim is run with "-u NONE" or "-C".
@@ -106,12 +106,13 @@ if has("autocmd")
106106
au!
107107

108108
" When editing a file, always jump to the last known cursor position.
109-
" Don't do it when the position is invalid or when inside an event handler
110-
" (happens when dropping a file on gvim).
109+
" Don't do it when the position is invalid, when inside an event handler
110+
" (happens when dropping a file on gvim) and for a commit message (it's
111+
" likely a different one than last time).
111112
autocmd BufReadPost *
112-
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
113-
\ exe "normal! g`\"" |
114-
\ endif
113+
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
114+
\ | exe "normal! g`\""
115+
\ | endif
115116

116117
augroup END
117118

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
639,
767769
/**/
768770
638,
769771
/**/

0 commit comments

Comments
 (0)