From 0c120307ca1ab613e63865c634d7e10ad67fb0ba Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 20 Dec 2023 14:32:22 +0100 Subject: refactor: eliminate cyclic includes --- src/nvim/cursor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 1110fe1e64..bcb2810095 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -22,6 +22,7 @@ #include "nvim/plines.h" #include "nvim/pos_defs.h" #include "nvim/state.h" +#include "nvim/types_defs.h" #include "nvim/vim_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit From af93a74a0f4afa9a3a4f55ffdf28141eaf776d22 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 18 Dec 2023 10:55:23 +0100 Subject: refactor: run IWYU on entire repo Reference: https://github.com/neovim/neovim/issues/6371. --- src/nvim/cursor.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index bcb2810095..d25566213c 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -11,7 +11,6 @@ #include "nvim/drawscreen.h" #include "nvim/fold.h" #include "nvim/globals.h" -#include "nvim/macros_defs.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" -- cgit From c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 28 Dec 2023 13:42:24 +0100 Subject: refactor: follow style guide --- src/nvim/cursor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index d25566213c..10b8a58ef4 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -291,7 +291,7 @@ linenr_T get_cursor_rel_lnum(win_T *wp, linenr_T lnum) // Loop until we reach to_line, skipping folds. for (; from_line < to_line; from_line++, retval++) { // If from_line is in a fold, set it to the last line of that fold. - (void)hasFoldingWin(wp, from_line, NULL, &from_line, true, NULL); + hasFoldingWin(wp, from_line, NULL, &from_line, true, NULL); } // If to_line is in a closed fold, the line count is off by +1. Correct it. -- cgit From 1813661a6197c76ea6621284570aca1d56597099 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 4 Jan 2024 15:38:16 +0100 Subject: refactor(IWYU): fix headers Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want. --- src/nvim/cursor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 10b8a58ef4..d8a63c1d7b 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -21,6 +21,7 @@ #include "nvim/plines.h" #include "nvim/pos_defs.h" #include "nvim/state.h" +#include "nvim/state_defs.h" #include "nvim/types_defs.h" #include "nvim/vim_defs.h" -- cgit From cdf848a314bf91a0c87c717f9a44742dea877515 Mon Sep 17 00:00:00 2001 From: VanaIgr Date: Mon, 18 Dec 2023 20:57:04 -0600 Subject: perf: reuse fast character size calculation algorithm from getvcol() --- src/nvim/cursor.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index d8a63c1d7b..6c0a81838f 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -141,17 +141,18 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a } } - chartabsize_T cts; - init_chartabsize_arg(&cts, curwin, pos->lnum, 0, line, line); - while (cts.cts_vcol <= wcol && *cts.cts_ptr != NUL) { - // Count a tab for what it's worth (if list mode not on) - csize = win_lbr_chartabsize(&cts, &head); - MB_PTR_ADV(cts.cts_ptr); - cts.cts_vcol += csize; + CharsizeArg arg; + CSType cstype = init_charsize_arg(&arg, curwin, pos->lnum, line); + StrCharInfo ci = utf_ptr2StrCharInfo(line); + col = 0; + while (col <= wcol && *ci.ptr != NUL) { + CharSize cs = win_charsize(cstype, col, ci.ptr, ci.chr.value, &arg); + csize = cs.width; + head = cs.head; + col += cs.width; + ci = utfc_next(ci); } - col = cts.cts_vcol; - idx = (int)(cts.cts_ptr - line); - clear_chartabsize_arg(&cts); + idx = (int)(ci.ptr - line); // Handle all the special cases. The virtual_active() check // is needed to ensure that a virtual position off the end of -- cgit From e68decab0352d553bd2463842d96379f56073a1c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 22 Jan 2024 10:39:37 +0800 Subject: refactor: use "csarg" for CharsizeArg variables (#27123) --- src/nvim/cursor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 6c0a81838f..3d31061d4c 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -141,12 +141,12 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a } } - CharsizeArg arg; - CSType cstype = init_charsize_arg(&arg, curwin, pos->lnum, line); + CharsizeArg csarg; + CSType cstype = init_charsize_arg(&csarg, curwin, pos->lnum, line); StrCharInfo ci = utf_ptr2StrCharInfo(line); col = 0; while (col <= wcol && *ci.ptr != NUL) { - CharSize cs = win_charsize(cstype, col, ci.ptr, ci.chr.value, &arg); + CharSize cs = win_charsize(cstype, col, ci.ptr, ci.chr.value, &csarg); csize = cs.width; head = cs.head; col += cs.width; -- cgit From 4e59422e1d4950a3042bad41a7b81c8db4f8b648 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 Jan 2024 07:57:21 +0800 Subject: refactor: IWYU (#27186) --- src/nvim/cursor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 3d31061d4c..e93e658f1e 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -13,6 +13,7 @@ #include "nvim/globals.h" #include "nvim/mark.h" #include "nvim/mbyte.h" +#include "nvim/mbyte_defs.h" #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/move.h" -- cgit