buf_T *newbuf;
int vertical = opt->jo_vertical || (cmdmod.cmod_split & WSP_VERT);
jobopt_T orig_opt; // only partly filled
+ pos_T save_cursor;
if (check_restricted() || check_secure())
return NULL;
old_curbuf = curbuf;
--curbuf->b_nwindows;
curbuf = buf;
+ save_cursor = curwin->w_cursor;
curwin->w_buffer = buf;
++curbuf->b_nwindows;
}
--curbuf->b_nwindows;
curbuf = old_curbuf;
curwin->w_buffer = curbuf;
+ curwin->w_cursor = save_cursor;
++curbuf->b_nwindows;
}
else if (vgetc_busy
call v9.CheckLegacyAndVim9Success(lines)
endfunc
+" Needs to come before Test_hidden_terminal(), why?
+func Test_autocmd_buffilepost_with_hidden_term()
+ CheckExecutable true
+ new XTestFile
+ defer delete('XTestFile')
+ call setline(1, ['one', 'two', 'three'])
+ call cursor(3, 10)
+ augroup TestCursor
+ au!
+ autocmd BufFilePost * call setbufvar(3, '&tabstop', 4)
+ augroup END
+
+ let buf = term_start(['true'], #{hidden: 1, term_finish: 'close'})
+ call term_wait(buf)
+ redraw!
+ call assert_equal('XTestFile', bufname('%'))
+ call assert_equal([0, 3, 5, 0], getpos('.'))
+
+ augroup TestCursor
+ au!
+ augroup END
+ augroup! TestCursor
+ bw! XTestFile
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab