From 7224c889e0d5d70b99ae377036baa6377c33a568 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 10:25:24 +0100 Subject: build: enable MSVC level 3 warnings (#21934) MSVC has 4 different warning levels: 1 (severe), 2 (significant), 3 (production quality) and 4 (informational). Enabling level 3 warnings mostly revealed conversion problems, similar to GCC/clang -Wconversion flag. --- src/nvim/diff.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 032de561b3..3bdc965146 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -3409,7 +3409,7 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk) linenr_T f1 = getdigits_int32(&p, true, 0); if (*p == ',') { p++; - l1 = getdigits(&p, true, 0); + l1 = getdigits_long(&p, true, 0); } else { l1 = f1; } @@ -3417,10 +3417,10 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk) return FAIL; // invalid diff format } int difftype = (uint8_t)(*p++); - long f2 = getdigits(&p, true, 0); + long f2 = getdigits_long(&p, true, 0); if (*p == ',') { p++; - l2 = getdigits(&p, true, 0); + l2 = getdigits_long(&p, true, 0); } else { l2 = f2; } @@ -3458,18 +3458,18 @@ static int parse_diff_unified(char *line, diffhunk_T *hunk) long oldcount; long newline; long newcount; - long oldline = getdigits(&p, true, 0); + long oldline = getdigits_long(&p, true, 0); if (*p == ',') { p++; - oldcount = getdigits(&p, true, 0); + oldcount = getdigits_long(&p, true, 0); } else { oldcount = 1; } if (*p++ == ' ' && *p++ == '+') { - newline = getdigits(&p, true, 0); + newline = getdigits_long(&p, true, 0); if (*p == ',') { p++; - newcount = getdigits(&p, true, 0); + newcount = getdigits_long(&p, true, 0); } else { newcount = 1; } -- cgit From 5f72ab77bff1f1224be5cbbf9423bdddbc25635c Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 12 Feb 2023 18:48:49 +0100 Subject: refactor: reduce scope of locals as per the style guide 3 (#22221) refactor: reduce scope of locals as per the style guide --- src/nvim/diff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 3bdc965146..c5b28822d0 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2652,8 +2652,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp) bool added = true; linenr_T off = lnum - dp->df_lnum[idx]; - int i; - for (i = 0; i < DB_COUNT; i++) { + for (int i = 0; i < DB_COUNT; i++) { if ((curtab->tp_diffbuf[i] != NULL) && (i != idx)) { // Skip lines that are not in the other change (filler lines). if (off >= dp->df_count[i]) { -- cgit From b50ee4a8dc4306e4be78ac33fb74b21dc6be5538 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Tue, 28 Feb 2023 07:09:12 +0900 Subject: fix(diff): adjust extmarks after diffput/diffget (#22440) Problem: on_bytes is not triggered by diffput/diffget if the line count does not change. --- src/nvim/diff.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index c5b28822d0..289939b2ca 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -31,6 +31,7 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" +#include "nvim/extmark.h" #include "nvim/extmark_defs.h" #include "nvim/fileio.h" #include "nvim/fold.h" @@ -3102,6 +3103,9 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr if (buf_empty && (curbuf->b_ml.ml_line_count == 2)) { // Added the first line into an empty buffer, need to // delete the dummy empty line. + // This has a side effect of incrementing curbuf->deleted_bytes, + // which results in inaccurate reporting of the byte count of + // previous contents in buffer-update events. buf_empty = false; ml_delete((linenr_T)2, false); } @@ -3143,6 +3147,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr } } } + extmark_adjust(curbuf, lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo); changed_lines(lnum, 0, lnum + count, added, true); if (did_free) { -- cgit From 2748202e0eb28574cdc65dcb758adea89023271d Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 11 Mar 2023 16:52:46 +0900 Subject: fix(diff): trigger on_bytes only once after diffget/diffput Problem: The fix from b50ee4a8dc4306e4be78ac33fb74b21dc6be5538 may adjust extmark twice, triggering on_bytes callback twice. Solution: Don't let mark_adjust adjust extmark. --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 289939b2ca..52c5732f23 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -3136,7 +3136,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr if (added != 0) { // Adjust marks. This will change the following entries! - mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo); + mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkNOOP); if (curwin->w_cursor.lnum >= lnum) { // Adjust the cursor position if it's in/after the changed // lines. -- cgit From 7bf1a917b78ebc622b6691af9196b95b4a9d3142 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 19 Apr 2023 13:15:29 +0100 Subject: vim-patch:8.1.2094: the fileio.c file is too big Problem: The fileio.c file is too big. Solution: Move buf_write() to bufwrite.c. (Yegappan Lakshmanan, closes vim/vim#4990) https://github.com/vim/vim/commit/c079f0fed1c16495d726d616c5362edc04742a0d Co-authored-by: Yegappan Lakshmanan Co-authored-by: zeertzjq --- src/nvim/diff.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 52c5732f23..b2efcbac58 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -22,6 +22,7 @@ #include "nvim/ascii.h" #include "nvim/autocmd.h" #include "nvim/buffer.h" +#include "nvim/bufwrite.h" #include "nvim/change.h" #include "nvim/charset.h" #include "nvim/cursor.h" -- cgit From 3b0df1780e2c8526bda5dead18ee7cc45925caba Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:23:44 +0200 Subject: refactor: uncrustify Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`. --- src/nvim/diff.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index b2efcbac58..f1a3a679be 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -328,7 +328,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T diff_T *dp = tp->tp_first_diff; linenr_T lnum_deleted = line1; // lnum of remaining deletion - for (;;) { + while (true) { // If the change is after the previous diff block and before the next // diff block, thus not touching an existing change, create a new diff // block. Don't do this when ex_diffgetput() is busy. @@ -588,7 +588,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp) linenr_T off_org = 0; linenr_T off_new = 0; int dir = FORWARD; - for (;;) { + while (true) { // Repeat until a line is found which is different or the number of // lines has become zero. while (dp->df_count[i_org] > 0) { @@ -1012,7 +1012,7 @@ static int check_external_diff(diffio_T *diffio) // May try twice, first with "-a" and then without. int io_error = false; TriState ok = kFalse; - for (;;) { + while (true) { ok = kFalse; FILE *fd = os_fopen(diffio->dio_orig.din_fname, "w"); @@ -1042,7 +1042,7 @@ static int check_external_diff(diffio_T *diffio) } else { char linebuf[LBUFLEN]; - for (;;) { + while (true) { // For normal diff there must be a line that contains // "1c1". For unified diff "@@ -1 +1 @@". if (vim_fgets(linebuf, LBUFLEN, fd)) { @@ -1560,7 +1560,7 @@ static bool extract_hunk_internal(diffout_T *dout, diffhunk_T *hunk, int *line_i // Extract hunk by parsing the diff output from file and calculate the diffstyle. static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle) { - for (;;) { + while (true) { char line[LBUFLEN]; // only need to hold the diff line if (vim_fgets(line, LBUFLEN, fd)) { return true; // end of file @@ -1747,7 +1747,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio) } } - for (;;) { + while (true) { diffhunk_T hunk = { 0 }; bool eof = dio->dio_internal ? extract_hunk_internal(dout, &hunk, &line_idx) @@ -2952,7 +2952,7 @@ void ex_diffgetput(exarg_T *eap) } const int idx_from = eap->cmdidx == CMD_diffget ? idx_other : idx_cur; - const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other; + const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other; // May give the warning for a changed buffer here, which can trigger the // FileChangedRO autocommand, which may do nasty things and mess -- cgit From b3d5138fd0066fda26ef7724a542ae45eb42fc84 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 7 Jun 2023 06:05:16 +0600 Subject: refactor(options): remove `getoption_T` and introduce `OptVal` (#23850) Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options. --- src/nvim/diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index f1a3a679be..810f631a02 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1389,14 +1389,14 @@ void ex_diffthis(exarg_T *eap) diff_win_options(curwin, true); } -static void set_diff_option(win_T *wp, int value) +static void set_diff_option(win_T *wp, bool value) { win_T *old_curwin = curwin; curwin = wp; curbuf = curwin->w_buffer; curbuf->b_ro_locked++; - set_option_value_give_err("diff", (long)value, NULL, OPT_LOCAL); + set_option_value_give_err("diff", BOOLEAN_OPTVAL(value), OPT_LOCAL); curbuf->b_ro_locked--; curwin = old_curwin; curbuf = curwin->w_buffer; -- cgit From fcf3519c65a2d6736de437f686e788684a6c8564 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 17 Apr 2023 22:18:58 +0200 Subject: refactor: remove long long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform. --- src/nvim/diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 810f631a02..64e47cbeb8 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2466,8 +2466,8 @@ int diffopt_changed(void) int linematch_lines_new = 0; int diff_flags_new = 0; int diff_foldcolumn_new = 2; - long diff_algorithm_new = 0; - long diff_indent_heuristic = 0; + int diff_algorithm_new = 0; + int diff_indent_heuristic = 0; char *p = p_dip; while (*p != NUL) { -- cgit From 5a25dcc5a4c73f50902432e32335ab073950cceb Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 12 Aug 2023 18:14:37 +0900 Subject: fix(diff): filler lines for hunks bigger than linematch limit (#24676) Apply linematch filler computation only if the hunk is actually linematched. Fixes #24580 --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 64e47cbeb8..1f8d21220b 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2384,7 +2384,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin) towin->w_topline = lnum + (dp->df_lnum[toidx] - dp->df_lnum[fromidx]); if (lnum >= dp->df_lnum[fromidx]) { - if (diff_flags & DIFF_LINEMATCH) { + if (dp->is_linematched) { calculate_topfill_and_topline(fromidx, toidx, fromwin->w_topline, fromwin->w_topfill, &towin->w_topfill, &towin->w_topline); } else { -- cgit From cefd774fac76b91f5368833555818c80c992c3b1 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 24 Aug 2023 15:14:23 +0200 Subject: refactor(memline): distinguish mutating uses of ml_get_buf() ml_get_buf() takes a third parameters to indicate whether the caller wants to mutate the memline data in place. However the vast majority of the call sites is using this function just to specify a buffer but without any mutation. This makes it harder to grep for the places which actually perform mutation. Solution: Remove the bool param from ml_get_buf(). it now works like ml_get() except for a non-current buffer. Add a new ml_get_buf_mut() function for the mutating use-case, which can be grepped along with the other ml_replace() etc functions which can modify the memline. --- src/nvim/diff.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 1f8d21220b..d3bd9f7754 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -596,9 +596,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp) if (dir == BACKWARD) { off_org = dp->df_count[i_org] - 1; } - char *line_org = xstrdup(ml_get_buf(tp->tp_diffbuf[i_org], - dp->df_lnum[i_org] + off_org, - false)); + char *line_org = xstrdup(ml_get_buf(tp->tp_diffbuf[i_org], dp->df_lnum[i_org] + off_org)); int i_new; for (i_new = i_org + 1; i_new < DB_COUNT; i_new++) { @@ -616,8 +614,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp) } if (diff_cmp(line_org, ml_get_buf(tp->tp_diffbuf[i_new], - dp->df_lnum[i_new] + off_new, - false)) != 0) { + dp->df_lnum[i_new] + off_new)) != 0) { break; } } @@ -756,7 +753,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e // xdiff requires one big block of memory with all the text. for (linenr_T lnum = start; lnum <= end; lnum++) { - len += strlen(ml_get_buf(buf, lnum, false)) + 1; + len += strlen(ml_get_buf(buf, lnum)) + 1; } char *ptr = try_malloc(len); if (ptr == NULL) { @@ -777,7 +774,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e len = 0; for (linenr_T lnum = start; lnum <= end; lnum++) { - char *s = ml_get_buf(buf, lnum, false); + char *s = ml_get_buf(buf, lnum); if (diff_flags & DIFF_ICASE) { while (*s != NUL) { char cbuf[MB_MAXBYTES + 1]; @@ -2244,11 +2241,9 @@ static bool diff_equal_entry(diff_T *dp, int idx1, int idx2) } for (int i = 0; i < dp->df_count[idx1]; i++) { - char *line = xstrdup(ml_get_buf(curtab->tp_diffbuf[idx1], - dp->df_lnum[idx1] + i, false)); + char *line = xstrdup(ml_get_buf(curtab->tp_diffbuf[idx1], dp->df_lnum[idx1] + i)); - int cmp = diff_cmp(line, ml_get_buf(curtab->tp_diffbuf[idx2], - dp->df_lnum[idx2] + i, false)); + int cmp = diff_cmp(line, ml_get_buf(curtab->tp_diffbuf[idx2], dp->df_lnum[idx2] + i)); xfree(line); if (cmp != 0) { @@ -2617,7 +2612,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { // Make a copy of the line, the next ml_get() will invalidate it. - char *line_org = xstrdup(ml_get_buf(wp->w_buffer, lnum, false)); + char *line_org = xstrdup(ml_get_buf(wp->w_buffer, lnum)); int idx = diff_buf_idx(wp->w_buffer); if (idx == DB_COUNT) { @@ -2661,7 +2656,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp) continue; } added = false; - char *line_new = ml_get_buf(curtab->tp_diffbuf[i], dp->df_lnum[i] + off, false); + char *line_new = ml_get_buf(curtab->tp_diffbuf[i], dp->df_lnum[i] + off); // Search for start of difference si_org = si_new = 0; @@ -3097,7 +3092,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) { break; } - char *p = xstrdup(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, false)); + char *p = xstrdup(ml_get_buf(curtab->tp_diffbuf[idx_from], nr)); ml_append(lnum + i - 1, p, 0, false); xfree(p); added++; -- cgit From 008154954791001efcc46c28146e21403f3a698b Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 21 Aug 2023 14:52:17 +0200 Subject: refactor(change): do API changes to buffer without curbuf switch Most of the messy things when changing a non-current buffer is not about the buffer, it is about windows. In particular, it is about `curwin`. When editing a non-current buffer which is displayed in some other window in the current tabpage, one such window will be "borrowed" as the curwin. But this means if two or more non-current windows displayed the buffers, one of them will be treated differenty. this is not desirable. In particular, with nvim_buf_set_text, cursor _column_ position was only corrected for one single window. Two new tests are added: the test with just one non-current window passes, but the one with two didn't. Two corresponding such tests were also added for nvim_buf_set_lines. This already worked correctly on master, but make sure this is well-tested for future refactors. Also, nvim_create_buf no longer invokes autocmds just because you happened to use `scratch=true`. No option value was changed, therefore OptionSet must not be fired. --- src/nvim/diff.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index d3bd9f7754..c5783ef00e 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -266,24 +266,25 @@ void diff_invalidate(buf_T *buf) } } -/// Called by mark_adjust(): update line numbers in "curbuf". +/// Called by mark_adjust(): update line numbers in "buf". /// /// @param line1 /// @param line2 /// @param amount /// @param amount_after -void diff_mark_adjust(linenr_T line1, linenr_T line2, linenr_T amount, linenr_T amount_after) +void diff_mark_adjust(buf_T *buf, linenr_T line1, linenr_T line2, linenr_T amount, + linenr_T amount_after) { - // Handle all tab pages that use the current buffer in a diff. + // Handle all tab pages that use "buf" in a diff. FOR_ALL_TABS(tp) { - int idx = diff_buf_idx_tp(curbuf, tp); + int idx = diff_buf_idx_tp(buf, tp); if (idx != DB_COUNT) { diff_mark_adjust_tp(tp, idx, line1, line2, amount, amount_after); } } } -/// Update line numbers in tab page "tp" for "curbuf" with index "idx". +/// Update line numbers in tab page "tp" for the buffer with index "idx". /// /// This attempts to update the changes as much as possible: /// When inserting/deleting lines outside of existing change blocks, create a @@ -2444,7 +2445,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin) } // When w_topline changes need to recompute w_botline and cursor position - invalidate_botline_win(towin); + invalidate_botline(towin); changed_line_abv_curs_win(towin); check_topfill(towin, false); @@ -3144,7 +3145,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr } } extmark_adjust(curbuf, lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo); - changed_lines(lnum, 0, lnum + count, added, true); + changed_lines(curbuf, lnum, 0, lnum + count, added, true); if (did_free) { // Diff is deleted, update folds in other windows. -- cgit From bc13bc154aa574e0bb58a50f2e0ca4570efa57c3 Mon Sep 17 00:00:00 2001 From: bfredl Date: Fri, 29 Sep 2023 16:10:54 +0200 Subject: refactor(message): smsg_attr -> smsg --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index c5783ef00e..4f2d510d8b 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -764,7 +764,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e buf->b_diff_failed = true; if (p_verbose > 0) { verbose_enter(); - smsg(_("Not enough memory to use internal diff for buffer \"%s\""), + smsg(0, _("Not enough memory to use internal diff for buffer \"%s\""), buf->b_fname); verbose_leave(); } -- cgit From cf8b2c0e74fd5e723b0c15c2ce84e6900fd322d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 12:05:28 +0800 Subject: build(iwyu): add a few more _defs.h mappings (#25435) --- src/nvim/diff.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 4f2d510d8b..9a47a78035 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -33,7 +33,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/extmark.h" -#include "nvim/extmark_defs.h" #include "nvim/fileio.h" #include "nvim/fold.h" #include "nvim/garray.h" -- cgit From dc6d0d2daf69e2fdadda81feb97906dbc962a239 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 14:41:34 +0800 Subject: refactor: reorganize option header files (#25437) - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other --- src/nvim/diff.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 9a47a78035..3ab1da76f4 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -47,6 +47,7 @@ #include "nvim/move.h" #include "nvim/normal.h" #include "nvim/option.h" +#include "nvim/option_vars.h" #include "nvim/optionstr.h" #include "nvim/os/fs_defs.h" #include "nvim/os/os.h" -- cgit From f06af5e66981095f3244f67d1587ce7e9853eb4c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 08:13:58 +0800 Subject: vim-patch:9.0.1958: cannot complete option values Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: vim/vim#13182 https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384 Co-authored-by: Yee Cheng Chin --- src/nvim/diff.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 3ab1da76f4..cb76cf17fc 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2467,6 +2467,7 @@ int diffopt_changed(void) char *p = p_dip; while (*p != NUL) { + // Note: Keep this in sync with p_dip_values if (strncmp(p, "filler", 6) == 0) { p += 6; diff_flags_new |= DIFF_FILLER; @@ -2513,6 +2514,7 @@ int diffopt_changed(void) p += 8; diff_flags_new |= DIFF_INTERNAL; } else if (strncmp(p, "algorithm:", 10) == 0) { + // Note: Keep this in sync with p_dip_algorithm_values. p += 10; if (strncmp(p, "myers", 5) == 0) { p += 5; -- cgit From e72b546354cd90bf0cd8ee6dd045538d713009ad Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index cb76cf17fc..8479675dfa 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -3135,7 +3135,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr if (added != 0) { // Adjust marks. This will change the following entries! - mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkNOOP); + mark_adjust(lnum, lnum + count - 1, MAXLNUM, added, kExtmarkNOOP); if (curwin->w_cursor.lnum >= lnum) { // Adjust the cursor position if it's in/after the changed // lines. @@ -3146,7 +3146,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr } } } - extmark_adjust(curbuf, lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo); + extmark_adjust(curbuf, lnum, lnum + count - 1, MAXLNUM, added, kExtmarkUndo); changed_lines(curbuf, lnum, 0, lnum + count, added, true); if (did_free) { -- cgit From 8e932480f61d6101bf8bea1abc07ed93826221fd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/diff.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 8479675dfa..b0663416ef 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -82,7 +82,7 @@ static bool diff_need_update = false; // ex_diffupdate needs to be called #define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF; -static long diff_algorithm = 0; +static int diff_algorithm = 0; static int linematch_lines = 0; #define LBUFLEN 50 // length of line in diff file @@ -3402,7 +3402,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp) /// static int parse_diff_ed(char *line, diffhunk_T *hunk) { - long l1, l2; + int l1, l2; // The line must be one of three formats: // change: {first}[,{last}]c{first}[,{last}] @@ -3412,7 +3412,7 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk) linenr_T f1 = getdigits_int32(&p, true, 0); if (*p == ',') { p++; - l1 = getdigits_long(&p, true, 0); + l1 = getdigits_int(&p, true, 0); } else { l1 = f1; } @@ -3420,10 +3420,10 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk) return FAIL; // invalid diff format } int difftype = (uint8_t)(*p++); - long f2 = getdigits_long(&p, true, 0); + int f2 = getdigits_int(&p, true, 0); if (*p == ',') { p++; - l2 = getdigits_long(&p, true, 0); + l2 = getdigits_int(&p, true, 0); } else { l2 = f2; } @@ -3448,31 +3448,29 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk) return OK; } -/// /// Parses unified diff with zero(!) context lines. /// Return FAIL if there is no diff information in "line". -/// static int parse_diff_unified(char *line, diffhunk_T *hunk) { // Parse unified diff hunk header: // @@ -oldline,oldcount +newline,newcount @@ char *p = line; if (*p++ == '@' && *p++ == '@' && *p++ == ' ' && *p++ == '-') { - long oldcount; - long newline; - long newcount; - long oldline = getdigits_long(&p, true, 0); + int oldcount; + linenr_T newline; + int newcount; + linenr_T oldline = getdigits_int32(&p, true, 0); if (*p == ',') { p++; - oldcount = getdigits_long(&p, true, 0); + oldcount = getdigits_int(&p, true, 0); } else { oldcount = 1; } if (*p++ == ' ' && *p++ == '+') { - newline = getdigits_long(&p, true, 0); + newline = getdigits_int(&p, true, 0); if (*p == ',') { p++; - newcount = getdigits_long(&p, true, 0); + newcount = getdigits_int(&p, true, 0); } else { newcount = 1; } @@ -3490,9 +3488,9 @@ static int parse_diff_unified(char *line, diffhunk_T *hunk) newline = 1; } - hunk->lnum_orig = (linenr_T)oldline; + hunk->lnum_orig = oldline; hunk->count_orig = oldcount; - hunk->lnum_new = (linenr_T)newline; + hunk->lnum_new = newline; hunk->count_new = newcount; return OK; @@ -3501,11 +3499,9 @@ static int parse_diff_unified(char *line, diffhunk_T *hunk) return FAIL; } -/// /// Callback function for the xdl_diff() function. /// Stores the diff output in a grow array. -/// -static int xdiff_out(long start_a, long count_a, long start_b, long count_b, void *priv) +static int xdiff_out(int start_a, int count_a, int start_b, int count_b, void *priv) { diffout_T *dout = (diffout_T *)priv; GA_APPEND(diffhunk_T, &(dout->dout_ga), ((diffhunk_T){ -- cgit From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/diff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index b0663416ef..c76e6aaa2f 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2950,7 +2950,7 @@ void ex_diffgetput(exarg_T *eap) } const int idx_from = eap->cmdidx == CMD_diffget ? idx_other : idx_cur; - const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other; + const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other; // May give the warning for a changed buffer here, which can trigger the // FileChangedRO autocommand, which may do nasty things and mess @@ -3505,10 +3505,10 @@ static int xdiff_out(int start_a, int count_a, int start_b, int count_b, void *p { diffout_T *dout = (diffout_T *)priv; GA_APPEND(diffhunk_T, &(dout->dout_ga), ((diffhunk_T){ - .lnum_orig = (linenr_T)start_a + 1, + .lnum_orig = (linenr_T)start_a + 1, .count_orig = count_a, - .lnum_new = (linenr_T)start_b + 1, - .count_new = count_b, + .lnum_new = (linenr_T)start_b + 1, + .count_new = count_b, })); return 0; } -- cgit From 2dc9ceb99c018b15dcf0c443cad46efecccaf94e Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 29 Oct 2023 09:02:32 +0100 Subject: docs: small fixes (#25585) Co-authored-by: tmummert Co-authored-by: parikshit adhikari --- src/nvim/diff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index c76e6aaa2f..8516e33638 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -3396,10 +3396,9 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp) return n; } -/// /// Handle an ED style diff line. -/// Return FAIL if the line does not contain diff info. /// +/// @return FAIL if the line does not contain diff info. static int parse_diff_ed(char *line, diffhunk_T *hunk) { int l1, l2; -- cgit From acc646ad8fc3ef11fcc63b69f3d8484e4a91accd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/diff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 8516e33638..920a535ddf 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -106,9 +106,9 @@ typedef struct { // used for recording hunks from xdiff typedef struct { linenr_T lnum_orig; - long count_orig; + int count_orig; linenr_T lnum_new; - long count_new; + int count_new; } diffhunk_T; // two diff inputs and one result @@ -771,7 +771,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e return FAIL; } m->ptr = ptr; - m->size = (long)len; + m->size = (int)len; len = 0; for (linenr_T lnum = start; lnum <= end; lnum++) { @@ -2571,7 +2571,7 @@ int diffopt_changed(void) // recompute the scroll binding with the new option value, may // remove or add filler lines - check_scrollbind((linenr_T)0, 0L); + check_scrollbind(0, 0); return OK; } @@ -3217,7 +3217,7 @@ bool diff_mode_buf(buf_T *buf) /// @param count /// /// @return FAIL if there isn't such a diff block. -int diff_move_to(int dir, long count) +int diff_move_to(int dir, int count) { linenr_T lnum = curwin->w_cursor.lnum; int idx = diff_buf_idx(curbuf); -- cgit From 8e58d37f2e15ac8540377148e55ed08a039aadb6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 11 Nov 2023 11:20:08 +0100 Subject: refactor: remove redundant casts --- src/nvim/diff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 920a535ddf..27c4899e05 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -824,7 +824,7 @@ static int diff_write(buf_T *buf, diffin_T *din) // so it shouldn't update the '[ and '] marks. cmdmod.cmod_flags |= CMOD_LOCKMARKS; int r = buf_write(buf, din->din_fname, NULL, - (linenr_T)1, buf->b_ml.ml_line_count, + 1, buf->b_ml.ml_line_count, NULL, false, false, false, true); cmdmod.cmod_flags = save_cmod_flags; free_string_option(buf->b_p_ff); @@ -1208,7 +1208,7 @@ void ex_diffpatch(exarg_T *eap) // Write the current buffer to "tmp_orig". if (buf_write(curbuf, tmp_orig, NULL, - (linenr_T)1, curbuf->b_ml.ml_line_count, + 1, curbuf->b_ml.ml_line_count, NULL, false, false, false, true) == FAIL) { goto theend; } @@ -3106,7 +3106,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr // which results in inaccurate reporting of the byte count of // previous contents in buffer-update events. buf_empty = false; - ml_delete((linenr_T)2, false); + ml_delete(2, false); } } linenr_T new_count = dp->df_count[idx_to] + added; @@ -3360,7 +3360,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp) if (idx == DB_COUNT) { // safety check - return (linenr_T)0; + return 0; } if (curtab->tp_diff_invalid) { @@ -3386,7 +3386,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp) if (i == DB_COUNT) { // safety check - return (linenr_T)0; + return 0; } linenr_T n = lnum + (dp->df_lnum[i] - dp->df_lnum[idx]); -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/diff.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 27c4899e05..aee0081e86 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - /// @file diff.c /// /// Code for diff'ing two, three or four buffers. @@ -1579,10 +1576,10 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle) *diffstyle = DIFF_ED; } else if ((strncmp(line, "@@ ", 3) == 0)) { *diffstyle = DIFF_UNIFIED; - } else if ((strncmp(line, "--- ", 4) == 0) // -V501 - && (vim_fgets(line, LBUFLEN, fd) == 0) // -V501 + } else if ((strncmp(line, "--- ", 4) == 0) + && (vim_fgets(line, LBUFLEN, fd) == 0) && (strncmp(line, "+++ ", 4) == 0) - && (vim_fgets(line, LBUFLEN, fd) == 0) // -V501 + && (vim_fgets(line, LBUFLEN, fd) == 0) && (strncmp(line, "@@ ", 3) == 0)) { *diffstyle = DIFF_UNIFIED; } else { -- cgit From 28f4f3c48498086307ed825d1761edb5789ca0e8 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 15:54:54 +0100 Subject: refactor: follow style guide - reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values --- src/nvim/diff.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index aee0081e86..9c75a21b2c 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -340,8 +340,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T dnext->df_lnum[idx] = line1; dnext->df_count[idx] = inserted; - int i; - for (i = 0; i < DB_COUNT; i++) { + for (int i = 0; i < DB_COUNT; i++) { if ((tp->tp_diffbuf[i] != NULL) && (i != idx)) { if (dprev == NULL) { dnext->df_lnum[i] = line1; @@ -472,8 +471,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T // check if this block touches the previous one, may merge them. if ((dprev != NULL) && !dp->is_linematched && (dprev->df_lnum[idx] + dprev->df_count[idx] == dp->df_lnum[idx])) { - int i; - for (i = 0; i < DB_COUNT; i++) { + for (int i = 0; i < DB_COUNT; i++) { if (tp->tp_diffbuf[i] != NULL) { dprev->df_count[i] += dp->df_count[i]; } -- cgit From 38a20dd89f91c45ec8589bf1c50d50732882d38a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 20:58:37 +0800 Subject: build(IWYU): replace most private mappings with pragmas (#26247) --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 9c75a21b2c..03103ecd65 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -46,7 +46,7 @@ #include "nvim/option.h" #include "nvim/option_vars.h" #include "nvim/optionstr.h" -#include "nvim/os/fs_defs.h" +#include "nvim/os/fs.h" #include "nvim/os/os.h" #include "nvim/os/shell.h" #include "nvim/path.h" -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/diff.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 03103ecd65..36e2678cbe 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -32,6 +32,7 @@ #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" +#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" -- cgit From f4aedbae4cb1f206f5b7c6142697b71dd473059b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:39:38 +0100 Subject: build(IWYU): fix includes for undo_defs.h --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 36e2678cbe..339e1d4c30 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -51,7 +51,7 @@ #include "nvim/os/os.h" #include "nvim/os/shell.h" #include "nvim/path.h" -#include "nvim/pos.h" +#include "nvim/pos_defs.h" #include "nvim/strings.h" #include "nvim/types.h" #include "nvim/ui.h" -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 339e1d4c30..cf4c98e5f9 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -53,7 +53,7 @@ #include "nvim/path.h" #include "nvim/pos_defs.h" #include "nvim/strings.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/undo.h" #include "nvim/vim.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/diff.c') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index cf4c98e5f9..0b7f6f266b 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -16,7 +16,7 @@ #include #include "auto/config.h" -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/autocmd.h" #include "nvim/buffer.h" #include "nvim/bufwrite.h" @@ -56,7 +56,7 @@ #include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/undo.h" -#include "nvim/vim.h" +#include "nvim/vim_defs.h" #include "nvim/window.h" #include "xdiff/xdiff.h" -- cgit