Patch 9.0.1498
Problem: In a terminal window the cursor may jump around. (Kenny Stauffer)
Solution: Do not move the cursor to the position for terminal-normal mode.
(closes #12312)
Files: src/terminal.c
*** ../vim-9.0.1497/src/terminal.c 2023-04-22 22:54:28.049802336 +0100
--- src/terminal.c 2023-04-29 14:24:50.063204173 +0100
***************
*** 1209,1214 ****
--- 1209,1232 ----
}
static void
+ position_cursor(win_T *wp, VTermPos *pos)
+ {
+ wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
+ wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
+ #ifdef FEAT_PROP_POPUP
+ if (popup_is_popup(wp))
+ {
+ wp->w_wrow += popup_top_extra(wp);
+ wp->w_wcol += popup_left_extra(wp);
+ wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
+ }
+ else
+ wp->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
+ #endif
+ wp->w_valid |= (VALID_WCOL|VALID_WROW);
+ }
+
+ static void
update_cursor(term_T *term, int redraw)
{
if (term->tl_normal_mode)
***************
*** 1219,1225 ****
--- 1237,1252 ----
term->tl_cursor_pos.col);
else
#endif
+ if (!term_job_running(term))
+ // avoid the cursor positioned below the last used line
setcursor();
+ else
+ {
+ // do not use the window cursor position
+ position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
+ windgoto(W_WINROW(curwin) + curwin->w_wrow,
+ curwin->w_wincol + curwin->w_wcol);
+ }
if (redraw)
{
aco_save_T aco;
***************
*** 2358,2381 ****
return OK;
}
- static void
- position_cursor(win_T *wp, VTermPos *pos)
- {
- wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
- wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
- #ifdef FEAT_PROP_POPUP
- if (popup_is_popup(wp))
- {
- wp->w_wrow += popup_top_extra(wp);
- wp->w_wcol += popup_left_extra(wp);
- wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
- }
- else
- wp->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
- #endif
- wp->w_valid |= (VALID_WCOL|VALID_WROW);
- }
-
/*
* Handle CTRL-W "": send register contents to the job.
*/
--- 2385,2390 ----
*** ../vim-9.0.1497/src/version.c 2023-04-29 12:09:50.118286706 +0100
--- src/version.c 2023-04-29 13:44:50.971368464 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1498,
/**/
--
ARTHUR: You are indeed brave Sir knight, but the fight is mine.
BLACK KNIGHT: Had enough?
ARTHUR: You stupid bastard. You havn't got any arms left.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230429132628.EB8781C0BF5%40moolenaar.net.