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/arabic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 41024cafda..bab77a4a84 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -28,7 +28,7 @@ #include "nvim/ascii.h" #include "nvim/macros.h" #include "nvim/mbyte.h" -#include "nvim/option_defs.h" +#include "nvim/option_vars.h" #include "nvim/vim.h" // Unicode values for Arabic characters. -- cgit From ddef39299f357d3131644647379e88a69749bf40 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 19 Sep 2023 14:30:02 +0200 Subject: refactor(grid): do arabic shaping in one place The 'arabicshape' feature of vim is a transformation of unicode text to make arabic and some related scripts look better at display time. In particular the content of a cell will be adjusted depending on the (original) content of the cells just before and after it. This is implemented by the arabic_shape() function in nvim. Before this commit, shaping was invoked in four different contexts: - when rendering buffer text in win_line() - in line_putchar() for rendering virtual text - as part of grid_line_puts, used by messages and statuslines and similar - as part of draw_cmdline() for drawing the cmdline This replaces all these with a post-processing step in grid_put_linebuf(), which has become the entry point for all text rendering after recent refactors. An aim of this is to make the handling of multibyte text yet simpler. One of the main reasons multibyte chars needs to be "parsed" into codepoint arrays of composing chars is so that these could be inspected for the purpose of shaping. This can likely be vastly simplified in many contexts where only the total length (in bytes) and width of composed char is needed. --- src/nvim/arabic.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index bab77a4a84..9dbb2c06e1 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -297,13 +297,12 @@ static int A_is_valid(int c) } // Do Arabic shaping on character "c". Returns the shaped character. -// out: "ccp" points to the first byte of the character to be shaped. // in/out: "c1p" points to the first composing char for "c". // in: "prev_c" is the previous character (not shaped) // in: "prev_c1" is the first composing char for the previous char // (not shaped) // in: "next_c" is the next character (not shaped). -int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c) +int arabic_shape(int c, int *c1p, int prev_c, int prev_c1, int next_c) { // Deal only with Arabic character, pass back all others if (!A_is_ok(c)) { @@ -347,14 +346,6 @@ int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c) curr_c = c; } - if ((curr_c != c) && (ccp != NULL)) { - char buf[MB_MAXBYTES + 1]; - - // Update the first byte of the character - utf_char2bytes(curr_c, buf); - *ccp = (uint8_t)buf[0]; - } - // Return the shaped character return curr_c; } -- 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/arabic.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 9dbb2c06e1..50ef761066 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.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 arabic.c /// /// Functions for Arabic language. -- cgit From bb4b4576e384c71890b4df4fa4f1ae76fad3a59d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Nov 2023 10:55:54 +0800 Subject: refactor: iwyu (#26062) --- src/nvim/arabic.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 50ef761066..226b042471 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -19,14 +19,11 @@ #include #include -#include #include "nvim/arabic.h" #include "nvim/ascii.h" #include "nvim/macros.h" -#include "nvim/mbyte.h" #include "nvim/option_vars.h" -#include "nvim/vim.h" // Unicode values for Arabic characters. enum { -- 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/arabic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 226b042471..e5ebd84cb3 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -22,6 +22,7 @@ #include "nvim/arabic.h" #include "nvim/ascii.h" +#include "nvim/func_attr.h" #include "nvim/macros.h" #include "nvim/option_vars.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/arabic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/arabic.c') diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index e5ebd84cb3..84f4297c99 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -21,9 +21,9 @@ #include #include "nvim/arabic.h" -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/func_attr.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/option_vars.h" // Unicode values for Arabic characters. -- cgit