1
0
forked from aniani/vim

patch 9.1.0787: cursor position changed when using hidden terminal

Problem:  cursor position changed when using hidden terminal
          and BufFilePost autocommand (Mizuno Jan Yuta)
Solution: Save and restore cursor position

fixes: #15854
closes: #15876

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-10-15 20:31:14 +02:00
parent 6a1deaf5ad
commit 991657e87d
3 changed files with 30 additions and 0 deletions

View File

@@ -446,6 +446,7 @@ term_start(
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;
@@ -518,6 +519,7 @@ term_start(
old_curbuf = curbuf;
--curbuf->b_nwindows;
curbuf = buf;
save_cursor = curwin->w_cursor;
curwin->w_buffer = buf;
++curbuf->b_nwindows;
}
@@ -763,6 +765,7 @@ term_start(
--curbuf->b_nwindows;
curbuf = old_curbuf;
curwin->w_buffer = curbuf;
curwin->w_cursor = save_cursor;
++curbuf->b_nwindows;
}
else if (vgetc_busy