patch 9.1.0114: Setting some options may change curswant
Problem: Setting some options changes curswant unnecessarily.
Solution: Add a P_HLONLY flag that prevents changing curswant.
(zeertzjq)
closes: #14044
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/option.c b/src/option.c
index f0e7727..dd3542f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4596,8 +4596,10 @@
#endif
comp_col(); // in case 'ruler' or 'showcmd' changed
+
if (curwin->w_curswant != MAXCOL
- && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
+ && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0
+ && (options[opt_idx].flags & P_HLONLY) == 0)
curwin->w_set_curswant = TRUE;
if ((opt_flags & OPT_NO_REDRAW) == 0)
@@ -4839,9 +4841,12 @@
#endif
comp_col(); // in case 'columns' or 'ls' changed
+
if (curwin->w_curswant != MAXCOL
- && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
+ && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0
+ && (options[opt_idx].flags & P_HLONLY) == 0)
curwin->w_set_curswant = TRUE;
+
if ((opt_flags & OPT_NO_REDRAW) == 0)
check_redraw(options[opt_idx].flags);
@@ -4862,11 +4867,14 @@
status_redraw_all();
if ((flags & P_RBUF) || (flags & P_RWIN) || all)
- changed_window_setting();
+ {
+ if (flags & P_HLONLY)
+ redraw_later(UPD_NOT_VALID);
+ else
+ changed_window_setting();
+ }
if (flags & P_RBUF)
redraw_curbuf_later(UPD_NOT_VALID);
- if (flags & P_RWINONLY)
- redraw_later(UPD_NOT_VALID);
if (doclear)
redraw_all_later(UPD_CLEAR);
else if (all)