Preserve cursor position after staging last untracked file

This commit is contained in:
Tim Pope 2019-08-01 19:27:35 -04:00
parent 7df9f07e1f
commit 0ab2d9709c

View File

@ -2244,7 +2244,7 @@ function! s:StageSeek(info, fallback) abort
endif
let line = search('^' . info.section, 'wn')
if !line
for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged']}, info.section, [])
for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Stacked']}, info.section, [])
let line = search('^' . section, 'wn')
if line
return line + (info.index > 0 ? 1 : 0)