refactor(core): group insert-mode globals in InsState #40712

Problem:
Insert-mode globals are scattered.

Solution:
Group them into one struct. Besides improving readability and
discoverability, this greatly helps with save/restore of an insert-mode
session.
This commit is contained in:
Justin M. Keyes
2026-07-13 09:06:04 -04:00
committed by GitHub
parent 07144616ca
commit 6ea01d37f8
15 changed files with 353 additions and 363 deletions

View File

@@ -1311,7 +1311,7 @@ static void ungetchars(int len, bool recorded)
/// - When no_u_sync is non-zero.
void may_sync_undo(void)
{
if ((!(State & (MODE_INSERT | MODE_CMDLINE)) || arrow_used)
if ((!(State & (MODE_INSERT | MODE_CMDLINE)) || Ins.arrow_used)
&& curscript < 0) {
u_sync(false);
}
@@ -2868,7 +2868,7 @@ static int vgetorpeek(bool advance)
// we are expecting to truncate the trailing
// white-space, so find the last non-white
// character -- webb
if (did_ai && *skipwhite(get_cursor_line_ptr() + curwin->w_cursor.col) == NUL) {
if (Ins.did_ai && *skipwhite(get_cursor_line_ptr() + curwin->w_cursor.col) == NUL) {
curwin->w_wcol = 0;
ptr = get_cursor_line_ptr();
char *endptr = ptr + curwin->w_cursor.col;