From 64fa75a86a9e2e301e884e21911d71688fc8f122 Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:35:51 +0100 Subject: fix(column): estimate 'statuscolumn' width appropriately Problem: The 'statuscolumn' width is being estimated without the proper context. In particular, this resulted in the fact that a custom fold column could be included in the estimated `number_width()`, and doubly added when actually drawing the statuscolumn due to `win_col_off()` also adding the `'foldcolumn'` width. Resulting in a status column that is `'foldcolumn'` cells wider than necessary. Solution: Estimate 'statuscolumn' width in `get_statuscol_str()` when a buffer's line count has changed. --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index f01edd1ad2..4c99191170 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1392,6 +1392,7 @@ struct window_S { int w_prev_fraction_row; linenr_T w_nrwidth_line_count; // line count when ml_nrwidth_width was computed. + linenr_T w_statuscol_line_count; // line count when 'statuscolumn' width was computed. int w_nrwidth_width; // nr of chars to print line count. qf_info_T *w_llist; // Location list for this window -- cgit From 08fb3b5309dee79585f3eec2450636966cbb01b4 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 31 Jan 2023 00:52:34 +0100 Subject: perf(column): only build fold/sign column when present in 'statuscolumn' Problem: The fold and sign column is built and stored regardless of whether the corresponding item is present in 'statuscolumn'. Solution: Since the 'statuscolumn' parses itself, we can defer building the columns until the corresponding item is actually encountered. --- src/nvim/buffer_defs.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 4c99191170..4f0e991ad5 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -18,6 +18,7 @@ typedef struct { #include "klib/kvec.h" #include "nvim/api/private/defs.h" #include "nvim/eval/typval.h" +#include "nvim/fold_defs.h" #include "nvim/garray.h" #include "nvim/grid_defs.h" #include "nvim/hashtab.h" @@ -1423,17 +1424,17 @@ struct statuscol { int width; ///< width of the status column int cur_attr; ///< current attributes in text int num_attr; ///< attributes used for line number - int fold_attr; ///< attributes used for fold column - int sign_attr[SIGN_SHOW_MAX + 1]; ///< attributes used for signs + int sign_cul_attr; ///< cursorline sign attr int truncate; ///< truncated width - bool draw; ///< draw statuscolumn or not - char fold_text[9 * 4 + 1]; ///< text in fold column (%C) - char *sign_text[SIGN_SHOW_MAX + 1]; ///< text in sign column (%s) + bool draw; ///< whether to draw the statuscolumn + bool use_cul; ///< whether to use cursorline attrs char text[MAXPATHL]; ///< text in status column char *textp; ///< current position in text char *text_end; ///< end of text (the NUL byte) stl_hlrec_t *hlrec; ///< highlight groups stl_hlrec_t *hlrecp; ///< current highlight group + foldinfo_T foldinfo; ///< fold information + SignTextAttrs *sattrs; ///< sign attributes }; /// Macros defined in Vim, but not in Neovim -- cgit From a4e376f09b30250e4e464a7c8b6c5278f0943ced Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 4 Feb 2023 11:05:24 +0100 Subject: refactor(statusline): move statusline defs to statusline_defs.h --- src/nvim/buffer_defs.h | 51 -------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 4f0e991ad5..dda8e7dacd 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -18,7 +18,6 @@ typedef struct { #include "klib/kvec.h" #include "nvim/api/private/defs.h" #include "nvim/eval/typval.h" -#include "nvim/fold_defs.h" #include "nvim/garray.h" #include "nvim/grid_defs.h" #include "nvim/hashtab.h" @@ -338,36 +337,6 @@ struct mapblock { bool m_replace_keycodes; // replace keycodes in result of expression }; -/// Used for highlighting in the status line. -typedef struct stl_hlrec stl_hlrec_t; -struct stl_hlrec { - char *start; - int userhl; // 0: no HL, 1-9: User HL, < 0 for syn ID -}; - -/// Used for building the status line. -typedef struct stl_item stl_item_t; -struct stl_item { - // Where the item starts in the status line output buffer - char *start; - // Function to run for ClickFunc items. - char *cmd; - // The minimum width of the item - int minwid; - // The maximum width of the item - int maxwid; - enum { - Normal, - Empty, - Group, - Separate, - Highlight, - TabPage, - ClickFunc, - Trunc, - } type; -}; - // values for b_syn_spell: what to do with toplevel text #define SYNSPL_DEFAULT 0 // spell check if @Spell not defined #define SYNSPL_TOP 1 // spell check toplevel text @@ -1417,26 +1386,6 @@ struct window_S { size_t w_statuscol_click_defs_size; }; -/// Struct to hold info for 'statuscolumn' -typedef struct statuscol statuscol_T; - -struct statuscol { - int width; ///< width of the status column - int cur_attr; ///< current attributes in text - int num_attr; ///< attributes used for line number - int sign_cul_attr; ///< cursorline sign attr - int truncate; ///< truncated width - bool draw; ///< whether to draw the statuscolumn - bool use_cul; ///< whether to use cursorline attrs - char text[MAXPATHL]; ///< text in status column - char *textp; ///< current position in text - char *text_end; ///< end of text (the NUL byte) - stl_hlrec_t *hlrec; ///< highlight groups - stl_hlrec_t *hlrecp; ///< current highlight group - foldinfo_T foldinfo; ///< fold information - SignTextAttrs *sattrs; ///< sign attributes -}; - /// Macros defined in Vim, but not in Neovim // uncrustify:off #define CHANGEDTICK(buf) \ -- cgit From 228684d2fbb6262f761b2b5d7001033bd69880c1 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sun, 5 Feb 2023 23:49:43 +0000 Subject: fix(decoration): don't show signcolumn for non-sign_text extmark (#22135) Fixes: #22127 --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 4c99191170..3601dc7062 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -838,6 +838,7 @@ struct file_buffer { Map(uint32_t, uint32_t) b_extmark_ns[1]; // extmark namespaces size_t b_virt_line_blocks; // number of virt_line blocks size_t b_signs; // number of sign extmarks + size_t b_signs_with_text; // number of sign extmarks with text // array of channel_id:s which have asked to receive updates for this // buffer. -- cgit From 53968082675cd3b8d1809e53a47c0311b7347ef9 Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:52:22 +0100 Subject: fix(folds): cursorline highlight is not always applied on closed folds (#22242) Problem: The cursorline highlight logic checks for `w_cursor.lnum` which may be different from the line number passed to `win_line()` even when the cursor is actually on that line. Solution: Update cursor line highlight logic to check for the line number of the start of a closed fold if necessary. --- src/nvim/buffer_defs.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3601dc7062..cace4b1364 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1112,20 +1112,23 @@ struct window_S { win_T *w_prev; ///< link to previous window win_T *w_next; ///< link to next window bool w_closing; ///< window is being closed, don't let - /// autocommands close it too. + ///< autocommands close it too. frame_T *w_frame; ///< frame containing this window pos_T w_cursor; ///< cursor position in buffer colnr_T w_curswant; ///< Column we want to be at. This is - /// used to try to stay in the same column - /// for up/down cursor motions. + ///< used to try to stay in the same column + ///< for up/down cursor motions. int w_set_curswant; // If set, then update w_curswant the next // time through cursupdate() to the // current virtual column + linenr_T w_cursorline; ///< Where 'cursorline' should be drawn, + ///< can be different from w_cursor.lnum + ///< for closed folds. linenr_T w_last_cursorline; ///< where last 'cursorline' was drawn pos_T w_last_cursormoved; ///< for CursorMoved event -- cgit From fe11079721084b3638ae3d8e5266f95d52028fb7 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 8 Mar 2023 12:36:03 +0100 Subject: perf(statusline): UI elements are always redrawn on K_EVENT Problem: 'statusline'-format UI elements are redrawn on each K_EVENT. Solution: Only redraw UI elements when something relevant has changed. --- src/nvim/buffer_defs.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 05901893b9..6122136a75 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1279,13 +1279,14 @@ struct window_S { bool w_redr_border; // if true border must be redrawn bool w_redr_statuscol; // if true 'statuscolumn' must be redrawn - // remember what is shown in the ruler for this window (if 'ruler' set) - pos_T w_ru_cursor; // cursor position shown in ruler - colnr_T w_ru_virtcol; // virtcol shown in ruler - linenr_T w_ru_topline; // topline shown in ruler - linenr_T w_ru_line_count; // line count used for ruler - int w_ru_topfill; // topfill shown in ruler - char w_ru_empty; // true if ruler shows 0-1 (empty line) + // remember what is shown in the 'statusline'-format elements + pos_T w_stl_cursor; // cursor position when last redrawn + colnr_T w_stl_virtcol; // virtcol when last redrawn + linenr_T w_stl_topline; // topline when last redrawn + linenr_T w_stl_line_count; // line count when last redrawn + int w_stl_topfill; // topfill when last redrawn + char w_stl_empty; // true if elements show 0-1 (empty line) + int w_stl_state; // State when last redrawn int w_alt_fnum; // alternate file (for # and CTRL-^) -- cgit From fd2ece278b0941ec6673489e88868120e86b834a Mon Sep 17 00:00:00 2001 From: Matthias Deiml Date: Sun, 12 Mar 2023 23:58:46 +0100 Subject: feat(ui): add scroll_delta to win_viewport event #19270 scroll_delta contains how much the top line of a window moved since the last time win_viewport was emitted. It is expected to be used to implement smooth scrolling. For this purpose it only counts "virtual" or "displayed" so folds should count as one line. Because of this it adds extra information that cannot be computed from the topline parameter. Fixes #19227 --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 6122136a75..4bdf5aac64 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1222,6 +1222,7 @@ struct window_S { colnr_T w_valid_leftcol; // last known w_leftcol bool w_viewport_invalid; + linenr_T w_viewport_last_topline; // topline when the viewport was last updated // w_cline_height is the number of physical lines taken by the buffer line // that the cursor is on. We use this to avoid extra calls to plines_win(). -- cgit From e3a3d300636872f786f0c8a338ed1a3749d0a1f6 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 1 Apr 2023 03:55:43 +0200 Subject: fix(ui): recording change doesn't trigger statusline redraw --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 4bdf5aac64..c808909942 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1288,6 +1288,7 @@ struct window_S { int w_stl_topfill; // topfill when last redrawn char w_stl_empty; // true if elements show 0-1 (empty line) int w_stl_state; // State when last redrawn + int w_stl_recording; // reg_recording when last redrawn int w_alt_fnum; // alternate file (for # and CTRL-^) -- 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/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index c808909942..02226f3cc4 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -607,7 +607,7 @@ struct file_buffer { int b_p_ai; ///< 'autoindent' int b_p_ai_nopaste; ///< b_p_ai saved for paste mode char *b_p_bkc; ///< 'backupco - unsigned int b_bkc_flags; ///< flags for 'backupco + unsigned b_bkc_flags; ///< flags for 'backupco int b_p_ci; ///< 'copyindent' int b_p_bin; ///< 'binary' int b_p_bomb; ///< 'bomb' -- cgit From be11f80d018797b514ed7d01cde2e4c8f88cc8d2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 01:55:00 +0200 Subject: vim-patch:9.0.0640: cannot scroll by screen line if a line wraps Problem: Cannot scroll by screen line if a line wraps. Solution: Add the 'smoothscroll' option. Only works for CTRL-E and CTRL-Y so far. https://github.com/vim/vim/commit/f6196f424474e2a9c160f2a995fc2691f82b58f9 vim-patch:9.0.0641: missing part of the new option code Problem: Missing part of the new option code. Solution: Add missing WV_SMS. https://github.com/vim/vim/commit/bbbda8fd81f6d720962b67ae885825bad9be4456 Co-authored-by: Bram Moolenaar --- src/nvim/buffer_defs.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 02226f3cc4..456acfd798 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -192,6 +192,8 @@ typedef struct { #define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' long wo_scr; #define w_p_scr w_onebuf_opt.wo_scr // 'scroll' + int wo_sms; +#define w_p_sms w_onebuf_opt.wo_sms // 'smoothscroll' int wo_spell; #define w_p_spell w_onebuf_opt.wo_spell // 'spell' int wo_cuc; @@ -1163,11 +1165,12 @@ struct window_S { bool w_botfill; // true when filler lines are actually // below w_topline (at end of file) bool w_old_botfill; // w_botfill at last redraw - colnr_T w_leftcol; // window column number of the left most + colnr_T w_leftcol; // screen column number of the left most // character in the window; used when // 'wrap' is off - colnr_T w_skipcol; // starting column when a single line - // doesn't fit in the window + colnr_T w_skipcol; // starting screen column for the first + // line in the window; used when 'wrap' is + // on // six fields that are only used when there is a WinScrolled autocommand linenr_T w_last_topline; ///< last known value for w_topline -- cgit From bf12a85a69f03bb5321fe0a32e1a9ac81f31750c Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 22:32:38 +0200 Subject: vim-patch:9.0.0734: cursor position invalid when scrolling with 'smoothscroll' Problem: Cursor position invalid when scrolling with 'smoothscroll' set. (Ernie Rael) Solution: Add w_valid_skipcol and clear flags when it changes. Adjust w_skipcol after moving the cursor. https://github.com/vim/vim/commit/2fbabd238a94022c99506e920186a5b6cdf15426 Co-authored-by: Bram Moolenaar --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 456acfd798..0f832d3659 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1223,6 +1223,7 @@ struct window_S { int w_valid; pos_T w_valid_cursor; // last known position of w_cursor, used to adjust w_valid colnr_T w_valid_leftcol; // last known w_leftcol + colnr_T w_valid_skipcol; // last known w_skipcol bool w_viewport_invalid; linenr_T w_viewport_last_topline; // topline when the viewport was last updated -- cgit From 223c7173eea2a4abec75611bd70051ea0b4c5d20 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 23:36:59 +0200 Subject: vim-patch:9.0.0746: breakindent test cases are commented out Problem: Breakindent test cases are commented out. Solution: Adjust expected result to slightly different behavior. Correct computations for cursor position. https://github.com/vim/vim/commit/856c5d2bc7c3864f8b63a0ab3e376d5c5e51f1d5 Co-authored-by: Bram Moolenaar --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 0f832d3659..ce8ee21882 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1170,7 +1170,7 @@ struct window_S { // 'wrap' is off colnr_T w_skipcol; // starting screen column for the first // line in the window; used when 'wrap' is - // on + // on; does not include win_col_off() // six fields that are only used when there is a WinScrolled autocommand linenr_T w_last_topline; ///< last known value for w_topline -- cgit From 6a273af10517d1f7e4ea85635f1d25a9158adeb5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 10:40:53 +0800 Subject: refactor: remove typval.h from most header files (#23601) Because typval_defs.h is enough for most of them. --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ce8ee21882..f8b26d9d16 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -17,7 +17,7 @@ typedef struct { #include "klib/kvec.h" #include "nvim/api/private/defs.h" -#include "nvim/eval/typval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/garray.h" #include "nvim/grid_defs.h" #include "nvim/hashtab.h" -- cgit From 0e1f3b5acf74e82ea778f3c0871a804a9ae89d4e Mon Sep 17 00:00:00 2001 From: Ibby <33922797+SleepySwords@users.noreply.github.com> Date: Sun, 19 Mar 2023 18:32:44 +1100 Subject: vim-patch:9.0.0130: cursor position wrong when inserting around virtual text Problem: Cursor position wrong when inserting around virtual text. Solution: Update the cursor position properly. https://github.com/vim/vim/commit/1f4ee19eefecd8f70b7cbe8ee9db8ace6352e23e Co-authored-by: tom-anders <13141438+tom-anders@users.noreply.github.com> --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index f8b26d9d16..f3f98bbd17 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -808,6 +808,7 @@ struct file_buffer { MarkTree b_marktree[1]; Map(uint32_t, uint32_t) b_extmark_ns[1]; // extmark namespaces + size_t b_virt_text_inline; // number of inline virtual texts size_t b_virt_line_blocks; // number of virt_line blocks size_t b_signs; // number of sign extmarks size_t b_signs_with_text; // number of sign extmarks with text -- cgit From 7b973c71ea845c9bcc6d98e101ad5a7956cb5802 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Jun 2023 19:24:42 +0800 Subject: fix(statusline): redraw when VIsual_mode changes (#23933) --- src/nvim/buffer_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index f3f98bbd17..e3e457cea6 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1292,8 +1292,9 @@ struct window_S { linenr_T w_stl_line_count; // line count when last redrawn int w_stl_topfill; // topfill when last redrawn char w_stl_empty; // true if elements show 0-1 (empty line) - int w_stl_state; // State when last redrawn int w_stl_recording; // reg_recording when last redrawn + int w_stl_state; // get_real_state() when last redrawn + int w_stl_visual_mode; // VIsual_mode when last redrawn int w_alt_fnum; // alternate file (for # and CTRL-^) -- cgit From f5d12889e80d3369359b8248806694cf6d21f820 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:00:32 +0200 Subject: refactor: adjust headers according to the style guide (#23934) System headers should be included first to prevent naming conflicts. --- src/nvim/buffer_defs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index e3e457cea6..d92d425ed5 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -18,6 +18,7 @@ typedef struct { #include "klib/kvec.h" #include "nvim/api/private/defs.h" #include "nvim/eval/typval_defs.h" +#include "nvim/extmark_defs.h" #include "nvim/garray.h" #include "nvim/grid_defs.h" #include "nvim/hashtab.h" @@ -25,9 +26,6 @@ typedef struct { #include "nvim/map.h" #include "nvim/mark_defs.h" #include "nvim/marktree.h" -// for float window title -#include "nvim/extmark_defs.h" -// for click definitions #include "nvim/option_defs.h" #include "nvim/pos.h" #include "nvim/statusline_defs.h" -- cgit From e8b3ed74bca4bd6ececcc240f816451bef7fd58c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Jul 2023 14:14:09 +0800 Subject: fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249) --- src/nvim/buffer_defs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d92d425ed5..5e9652792a 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1226,6 +1226,8 @@ struct window_S { bool w_viewport_invalid; linenr_T w_viewport_last_topline; // topline when the viewport was last updated + linenr_T w_viewport_last_topfill; // topfill when the viewport was last updated + linenr_T w_viewport_last_skipcol; // skipcol when the viewport was last updated // w_cline_height is the number of physical lines taken by the buffer line // that the cursor is on. We use this to avoid extra calls to plines_win(). -- cgit From a76b689b479e89d6feae687443d13ec38602a1a6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Jul 2023 16:48:53 +0800 Subject: perf(ui-ext): approximate scroll_delta when scrolling too much (#24234) --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 5e9652792a..5708274848 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1226,6 +1226,7 @@ struct window_S { bool w_viewport_invalid; linenr_T w_viewport_last_topline; // topline when the viewport was last updated + linenr_T w_viewport_last_botline; // botline when the viewport was last updated linenr_T w_viewport_last_topfill; // topfill when the viewport was last updated linenr_T w_viewport_last_skipcol; // skipcol when the viewport was last updated -- cgit From 58a1ef8e6a93c615379f6fbe7234697bcdc42b3e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 12 Aug 2023 09:50:17 +0800 Subject: fix(events): avoid unnecessary CursorMoved (#24675) Problem: Temporarily changing current window in a script causes CursorMoved to be triggerd. Solution: Don't trigger CursorMoved if neither curwin nor cursor changed between two checks. --- src/nvim/buffer_defs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 5708274848..ca1f791d28 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1101,7 +1101,6 @@ struct window_S { ///< can be different from w_cursor.lnum ///< for closed folds. linenr_T w_last_cursorline; ///< where last 'cursorline' was drawn - pos_T w_last_cursormoved; ///< for CursorMoved event // the next seven are used to update the visual part char w_old_visual_mode; ///< last known VIsual_mode -- cgit From a2a226170d178086592967f23c39112811178f0c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 21 Aug 2023 08:58:18 +0800 Subject: vim-patch:9.0.1772: Cursor may be adjusted in 'splitkeep'ed windows (#24811) Problem: Cursor is adjusted in window that did not change in size by 'splitkeep'. Solution: Only check that cursor position is valid in a window that has changed in size. closes: vim/vim#12509 https://github.com/vim/vim/commit/16af913eeefb288ce968fb87e09a597413861900 Co-authored-by: Luuk van Baal --- src/nvim/buffer_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ca1f791d28..0a7c742798 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1194,6 +1194,7 @@ struct window_S { int w_hsep_height; // Number of horizontal separator rows (0 or 1) int w_vsep_width; // Number of vertical separator columns (0 or 1). pos_save_T w_save_cursor; // backup of cursor pos and topline + bool w_do_win_fix_cursor; // if true cursor may be invalid int w_winrow_off; ///< offset from winrow to the inner window area int w_wincol_off; ///< offset from wincol to the inner window area -- cgit From 0ba27bb51d3297aec43e78050cc3adcf6879db22 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 23 Aug 2023 16:32:15 +0800 Subject: vim-patch:9.0.1710: scrolloff options work slightly different Problem: sidescrolloff and scrolloff options work slightly different than other global-local options Solution: Make it behave consistent for all global-local options It was noticed, that sidescrolloff and scrolloff options behave differently in comparison to other global-local window options like 'listchars' So make those two behave like other global-local options. Also add some extra documentation for a few special local-window options. Add a few tests to make sure all global-local window options behave similar closes: vim/vim#12956 closes: vim/vim#12643 https://github.com/vim/vim/commit/4a8eb6e7a9df10f79bf95301ced012f0d6a13088 Co-authored-by: Christian Brabandt --- src/nvim/buffer_defs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 0a7c742798..c94dbfa7fb 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -230,6 +230,10 @@ typedef struct { #define w_p_crb_save w_onebuf_opt.wo_crb_save char *wo_scl; #define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' + long wo_siso; +#define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value + long wo_so; +#define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value char *wo_winhl; #define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' char *wo_lcs; @@ -1321,8 +1325,6 @@ struct window_S { uint32_t w_p_fdt_flags; // flags for 'foldtext' int *w_p_cc_cols; // array of columns to highlight or NULL uint8_t w_p_culopt_flags; // flags for cursorline highlighting - long w_p_siso; // 'sidescrolloff' local value - long w_p_so; // 'scrolloff' local value int w_briopt_min; // minimum width for breakindent int w_briopt_shift; // additional shift for breakindent -- cgit From 1635c9e75e21e07c4331cf983e14a11c7e09b119 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 26 Aug 2023 11:13:20 +0800 Subject: refactor: move some structs out of buffer_defs.h (#24878) --- src/nvim/buffer_defs.h | 95 +++----------------------------------------------- 1 file changed, 5 insertions(+), 90 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index c94dbfa7fb..2d83242275 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -7,8 +7,8 @@ typedef struct file_buffer buf_T; // Forward declaration -// Reference to a buffer that stores the value of buf_free_count. -// bufref_valid() only needs to check "buf" when the count differs. +/// Reference to a buffer that stores the value of buf_free_count. +/// bufref_valid() only needs to check "buf" when the count differs. typedef struct { buf_T *br_buf; int br_fnum; @@ -17,6 +17,7 @@ typedef struct { #include "klib/kvec.h" #include "nvim/api/private/defs.h" +#include "nvim/arglist_defs.h" #include "nvim/eval/typval_defs.h" #include "nvim/extmark_defs.h" #include "nvim/garray.h" @@ -24,6 +25,7 @@ typedef struct { #include "nvim/hashtab.h" #include "nvim/highlight_defs.h" #include "nvim/map.h" +#include "nvim/mapping_defs.h" #include "nvim/mark_defs.h" #include "nvim/marktree.h" #include "nvim/option_defs.h" @@ -100,28 +102,6 @@ typedef struct taggy { char *user_data; // used with tagfunc } taggy_T; -typedef struct buffblock buffblock_T; -typedef struct buffheader buffheader_T; - -// structure used to store one block of the stuff/redo/recording buffers -struct buffblock { - buffblock_T *b_next; // pointer to next buffblock - char b_str[1]; // contents (actually longer) -}; - -// header used for the stuff buffer and the redo buffer -struct buffheader { - buffblock_T bh_first; // first (dummy) block of list - buffblock_T *bh_curr; // buffblock for appending - size_t bh_index; // index for reading - size_t bh_space; // space in bh_curr for appending -}; - -typedef struct { - buffheader_T sr_redobuff; - buffheader_T sr_old_redobuff; -} save_redo_T; - // Structure that contains all options that are local to a window. // Used twice in a window: for the current buffer and for all buffers. // Also used in wininfo_T. @@ -267,27 +247,7 @@ struct wininfo_S { int wi_changelistidx; // copy of w_changelistidx }; -// Argument list: Array of file names. -// Used for the global argument list and the argument lists local to a window. -// -// TODO(neovim): move struct arglist to another header -typedef struct arglist { - garray_T al_ga; // growarray with the array of file names - int al_refcount; // number of windows using this arglist - int id; ///< id of this arglist -} alist_T; - -// For each argument remember the file name as it was given, and the buffer -// number that contains the expanded file name (required for when ":cd" is -// used). -// -// TODO(Felipe): move aentry_T to another header -typedef struct argentry { - char *ae_fname; // file name as specified - int ae_fnum; // buffer number with expanded file name -} aentry_T; - -#define ALIST(win) (win)->w_alist +#define ALIST(win) (win)->w_alist #define GARGLIST ((aentry_T *)global_alist.al_ga.ga_data) #define ARGLIST ((aentry_T *)ALIST(curwin)->al_ga.ga_data) #define WARGLIST(wp) ((aentry_T *)ALIST(wp)->al_ga.ga_data) @@ -296,51 +256,6 @@ typedef struct argentry { #define ARGCOUNT (ALIST(curwin)->al_ga.ga_len) #define WARGCOUNT(wp) (ALIST(wp)->al_ga.ga_len) -// Used for the typeahead buffer: typebuf. -typedef struct { - uint8_t *tb_buf; // buffer for typed characters - uint8_t *tb_noremap; // mapping flags for characters in tb_buf[] - int tb_buflen; // size of tb_buf[] - int tb_off; // current position in tb_buf[] - int tb_len; // number of valid bytes in tb_buf[] - int tb_maplen; // nr of mapped bytes in tb_buf[] - int tb_silent; // nr of silently mapped bytes in tb_buf[] - int tb_no_abbr_cnt; // nr of bytes without abbrev. in tb_buf[] - int tb_change_cnt; // nr of time tb_buf was changed; never zero -} typebuf_T; - -// Struct to hold the saved typeahead for save_typeahead(). -typedef struct { - typebuf_T save_typebuf; - bool typebuf_valid; // true when save_typebuf valid - int old_char; - int old_mod_mask; - buffheader_T save_readbuf1; - buffheader_T save_readbuf2; - String save_inputbuf; -} tasave_T; - -// Structure used for mappings and abbreviations. -typedef struct mapblock mapblock_T; -struct mapblock { - mapblock_T *m_next; // next mapblock in list - char *m_keys; // mapped from, lhs - char *m_str; // mapped to, rhs - char *m_orig_str; // rhs as entered by the user - LuaRef m_luaref; // lua function reference as rhs - int m_keylen; // strlen(m_keys) - int m_mode; // valid mode - int m_simplified; // m_keys was simplified, do no use this map - // if keys are typed - int m_noremap; // if non-zero no re-mapping for m_str - char m_silent; // used, don't echo commands - char m_nowait; // used - char m_expr; // used, m_str is an expression - sctx_T m_script_ctx; // SCTX where map was defined - char *m_desc; // description of mapping - bool m_replace_keycodes; // replace keycodes in result of expression -}; - // values for b_syn_spell: what to do with toplevel text #define SYNSPL_DEFAULT 0 // spell check if @Spell not defined #define SYNSPL_TOP 1 // spell check toplevel text -- cgit From 617fd5bdc6ab9a82bfc6136f549fc31dcf442ed7 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 25 Aug 2023 10:53:29 +0300 Subject: refactor(float): extract "title" and "title_pos" handling --- src/nvim/buffer_defs.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 2d83242275..ba6a3a1e27 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -936,6 +936,10 @@ typedef enum { kAlignRight = 2, } AlignTextPos; +typedef enum { + kBorderTextTitle = 0, +} BorderTextType; + typedef struct { Window window; lpos_T bufpos; -- cgit From 35570e4a11bef061777d741929f74fa66ba3f45a Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 25 Aug 2023 10:53:35 +0300 Subject: feat(float): implement footer Problem: Now way to show text at the bottom part of floating window border (a.k.a. "footer"). Solution: Allows `footer` and `footer_pos` config fields similar to `title` and `title_pos`. --- src/nvim/buffer_defs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ba6a3a1e27..3f55dbbc00 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -938,6 +938,7 @@ typedef enum { typedef enum { kBorderTextTitle = 0, + kBorderTextFooter = 1, } BorderTextType; typedef struct { @@ -952,14 +953,18 @@ typedef struct { int zindex; WinStyle style; bool border; - bool title; bool shadow; schar_T border_chars[8]; int border_hl_ids[8]; int border_attr[8]; + bool title; AlignTextPos title_pos; VirtText title_chunks; int title_width; + bool footer; + AlignTextPos footer_pos; + VirtText footer_chunks; + int footer_width; bool noautocmd; } FloatConfig; -- cgit From 211edceb4f4d4d0f6c41a6ee56891a6f9407e3a7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Sep 2023 21:01:19 +0800 Subject: vim-patch:8.2.4173: cannot use an import in 'foldexpr' (#25215) Problem: Cannot use an import in 'foldexpr'. Solution: Set the script context to where 'foldexpr' was set. (closes vim/vim#9584) Fix that the script context was not set for all buffers. https://github.com/vim/vim/commit/e70dd11ef41f69bd5e94f630194e6b3c4f3f2102 Co-authored-by: Bram Moolenaar --- src/nvim/buffer_defs.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3f55dbbc00..3229cb2fe7 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1241,6 +1241,8 @@ struct window_S { // this window, w_allbuf_opt is for all buffers in this window. winopt_T w_onebuf_opt; winopt_T w_allbuf_opt; + // transform a pointer to a "onebuf" option into a "allbuf" option +#define GLOBAL_WO(p) ((char *)(p) + sizeof(winopt_T)) // A few options have local flags for P_INSECURE. uint32_t w_p_stl_flags; // flags for 'statusline' @@ -1256,9 +1258,6 @@ struct window_S { int w_briopt_list; // additional indent for lists int w_briopt_vcol; // indent for specific column - // transform a pointer to a "onebuf" option into a "allbuf" option -#define GLOBAL_WO(p) ((char *)(p) + sizeof(winopt_T)) - long w_scbind_pos; ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary. -- cgit From fd08fd3de3020647c8ae73f1c7d2cf9a4926c828 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 14 Sep 2023 13:30:51 +0800 Subject: fix(float): add fixd option --- src/nvim/buffer_defs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3f55dbbc00..10e6cde280 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -966,6 +966,7 @@ typedef struct { VirtText footer_chunks; int footer_width; bool noautocmd; + bool fixed; } FloatConfig; #define FLOAT_CONFIG_INIT ((FloatConfig){ .height = 0, .width = 0, \ @@ -975,7 +976,8 @@ typedef struct { .focusable = true, \ .zindex = kZIndexFloatDefault, \ .style = kWinStyleUnused, \ - .noautocmd = false }) + .noautocmd = false, \ + .fixed = false }) // Structure to store last cursor position and topline. Used by check_lnums() // and reset_lnums(). -- cgit From 8da986ea877b07a5eb117446f410f2a7fc8cd9cb Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 13 Sep 2023 13:39:18 +0200 Subject: refactor(grid): change schar_T representation to be more compact Previously, a screen cell would occupy 28+4=32 bytes per cell as we always made space for up to MAX_MCO+1 codepoints in a cell. As an example, even a pretty modest 50*80 screen would consume 50*80*2*32 = 256000, i e a quarter megabyte With the factor of two due to the TUI side buffer, and even more when using msg_grid and/or ext_multigrid. This instead stores a 4-byte union of either: - a valid UTF-8 sequence up to 4 bytes - an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a glyph cache This avoids allocating space for huge composed glyphs _upfront_, while still keeping rendering such glyphs reasonably fast (1 hash table lookup + one plain index lookup). If the same large glyphs are using repeatedly on the screen, this is still a net reduction of memory/cache consumption. The only case which really gets worse is if you blast the screen full with crazy emojis and zalgo text and even this case only leads to 4 extra bytes per char. When only <= 4-byte glyphs are used, plus the 4-byte attribute code, i e 8 bytes in total there is a factor of four reduction of memory use. Memory which will be quite hot in cache as the screen buffer is scanned over in win_line() buffer text drawing A slight complication is that the representation depends on host byte order. I've tested this manually by compling and running this in qemu-s390x and it works fine. We might add a qemu based solution to CI at some point. --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3229cb2fe7..2698af98e2 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -954,7 +954,7 @@ typedef struct { WinStyle style; bool border; bool shadow; - schar_T border_chars[8]; + char border_chars[8][MAX_SCHAR_SIZE]; int border_hl_ids[8]; int border_attr[8]; bool title; -- cgit From b65f4151d9e52a8521c0682a817c4dab9690e1e7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 27 Sep 2023 18:51:40 +0800 Subject: vim-patch:8.2.3517: TextChanged does not trigger after TextChangedI (#25384) Problem: TextChanged does not trigger after TextChangedI. Solution: Store the tick separately for TextChangedI. (Christian Brabandt, closes vim/vim#8968, closes vim/vim#8932) https://github.com/vim/vim/commit/db3b44640d69ab27270691a3cab8d83cc93a0861 Co-authored-by: Christian Brabandt --- src/nvim/buffer_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ff0fca1a56..f267dbb2f1 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -418,10 +418,10 @@ struct file_buffer { /// This is a dictionary item used to store b:changedtick. ChangedtickDictItem changedtick_di; - varnumber_T b_last_changedtick; // b:changedtick when TextChanged or - // TextChangedI was last triggered. - varnumber_T b_last_changedtick_pum; // b:changedtick when TextChangedP was + varnumber_T b_last_changedtick; // b:changedtick when TextChanged was // last triggered. + varnumber_T b_last_changedtick_i; // b:changedtick for TextChangedI + varnumber_T b_last_changedtick_pum; // b:changedtick for TextChangedP bool b_saving; // Set to true if we are in the middle of // saving the buffer. -- cgit From af7d317f3ff31d5ac5d8724b5057a422e1451b54 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 26 Sep 2023 22:36:08 +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/buffer_defs.h | 76 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index f267dbb2f1..f0fdf0a230 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -125,18 +125,18 @@ typedef struct { #define w_p_fen_save w_onebuf_opt.wo_fen_save char *wo_fdi; #define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore' - long wo_fdl; + OptInt wo_fdl; #define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel' - long wo_fdl_save; + OptInt wo_fdl_save; // 'foldlevel' state saved for diff mode #define w_p_fdl_save w_onebuf_opt.wo_fdl_save char *wo_fdm; #define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod' char *wo_fdm_save; #define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode - long wo_fml; + OptInt wo_fml; #define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines' - long wo_fdn; + OptInt wo_fdn; #define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' char *wo_fde; #define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' @@ -156,7 +156,7 @@ typedef struct { #define w_p_ve w_onebuf_opt.wo_ve // 'virtualedit' unsigned wo_ve_flags; #define w_ve_flags w_onebuf_opt.wo_ve_flags // flags for 'virtualedit' - long wo_nuw; + OptInt wo_nuw; #define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth' int wo_wfh; #define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' @@ -168,7 +168,7 @@ typedef struct { #define w_p_rl w_onebuf_opt.wo_rl // 'rightleft' char *wo_rlc; #define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' - long wo_scr; + OptInt wo_scr; #define w_p_scr w_onebuf_opt.wo_scr // 'scroll' int wo_sms; #define w_p_sms w_onebuf_opt.wo_sms // 'smoothscroll' @@ -202,7 +202,7 @@ typedef struct { #define w_p_wrap_save w_onebuf_opt.wo_wrap_save char *wo_cocu; // 'concealcursor' #define w_p_cocu w_onebuf_opt.wo_cocu - long wo_cole; // 'conceallevel' + OptInt wo_cole; // 'conceallevel' #define w_p_cole w_onebuf_opt.wo_cole int wo_crb; #define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind' @@ -210,9 +210,9 @@ typedef struct { #define w_p_crb_save w_onebuf_opt.wo_crb_save char *wo_scl; #define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' - long wo_siso; + OptInt wo_siso; #define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value - long wo_so; + OptInt wo_so; #define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value char *wo_winhl; #define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' @@ -220,7 +220,7 @@ typedef struct { #define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars' char *wo_fcs; #define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars' - long wo_winbl; + OptInt wo_winbl; #define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend' LastSet wo_script_ctx[WV_COUNT]; // SCTXs for window-local options @@ -504,8 +504,8 @@ struct file_buffer { bool b_scanned; // ^N/^P have scanned this buffer // flags for use of ":lmap" and IM control - long b_p_iminsert; // input mode for insert - long b_p_imsearch; // input mode for search + OptInt b_p_iminsert; // input mode for insert + OptInt b_p_imsearch; // input mode for search #define B_IMODE_USE_INSERT (-1) // Use b_p_iminsert value for search #define B_IMODE_NONE 0 // Input via none #define B_IMODE_LMAP 1 // Input via langmap @@ -534,7 +534,7 @@ struct file_buffer { char *b_p_bt; ///< 'buftype' int b_has_qf_entry; ///< quickfix exists for buffer int b_p_bl; ///< 'buflisted' - long b_p_channel; ///< 'channel' + OptInt b_p_channel; ///< 'channel' int b_p_cin; ///< 'cindent' char *b_p_cino; ///< 'cinoptions' char *b_p_cink; ///< 'cinkeys' @@ -587,27 +587,27 @@ struct file_buffer { int b_p_pi; ///< 'preserveindent' char *b_p_qe; ///< 'quoteescape' int b_p_ro; ///< 'readonly' - long b_p_sw; ///< 'shiftwidth' - long b_p_scbk; ///< 'scrollback' + OptInt b_p_sw; ///< 'shiftwidth' + OptInt b_p_scbk; ///< 'scrollback' int b_p_si; ///< 'smartindent' - long b_p_sts; ///< 'softtabstop' - long b_p_sts_nopaste; ///< b_p_sts saved for paste mode + OptInt b_p_sts; ///< 'softtabstop' + OptInt b_p_sts_nopaste; ///< b_p_sts saved for paste mode char *b_p_sua; ///< 'suffixesadd' int b_p_swf; ///< 'swapfile' - long b_p_smc; ///< 'synmaxcol' + OptInt b_p_smc; ///< 'synmaxcol' char *b_p_syn; ///< 'syntax' - long b_p_ts; ///< 'tabstop' - long b_p_tw; ///< 'textwidth' - long b_p_tw_nobin; ///< b_p_tw saved for binary mode - long b_p_tw_nopaste; ///< b_p_tw saved for paste mode - long b_p_wm; ///< 'wrapmargin' - long b_p_wm_nobin; ///< b_p_wm saved for binary mode - long b_p_wm_nopaste; ///< b_p_wm saved for paste mode + OptInt b_p_ts; ///< 'tabstop' + OptInt b_p_tw; ///< 'textwidth' + OptInt b_p_tw_nobin; ///< b_p_tw saved for binary mode + OptInt b_p_tw_nopaste; ///< b_p_tw saved for paste mode + OptInt b_p_wm; ///< 'wrapmargin' + OptInt b_p_wm_nobin; ///< b_p_wm saved for binary mode + OptInt b_p_wm_nopaste; ///< b_p_wm saved for paste mode char *b_p_vsts; ///< 'varsofttabstop' - long *b_p_vsts_array; ///< 'varsofttabstop' in internal format + colnr_T *b_p_vsts_array; ///< 'varsofttabstop' in internal format char *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode char *b_p_vts; ///< 'vartabstop' - long *b_p_vts_array; ///< 'vartabstop' in internal format + colnr_T *b_p_vts_array; ///< 'vartabstop' in internal format char *b_p_keymap; ///< 'keymap' // local values for options which are normally global @@ -624,7 +624,7 @@ struct file_buffer { char *b_p_tsr; ///< 'thesaurus' local value char *b_p_tsrfu; ///< 'thesaurusfunc' local value Callback b_tsrfu_cb; ///< 'thesaurusfunc' callback - long b_p_ul; ///< 'undolevels' local value + OptInt b_p_ul; ///< 'undolevels' local value int b_p_udf; ///< 'undofile' char *b_p_lw; ///< 'lispwords' local value @@ -789,16 +789,16 @@ struct diffblock_S { typedef struct tabpage_S tabpage_T; struct tabpage_S { handle_T handle; - tabpage_T *tp_next; ///< next tabpage or NULL - frame_T *tp_topframe; ///< topframe for the windows - win_T *tp_curwin; ///< current window in this Tab page - win_T *tp_prevwin; ///< previous window in this Tab page - win_T *tp_firstwin; ///< first window in this Tab page - win_T *tp_lastwin; ///< last window in this Tab page - long tp_old_Rows_avail; ///< ROWS_AVAIL when Tab page was left - long tp_old_Columns; ///< Columns when Tab page was left, -1 when - ///< calling win_new_screen_cols() postponed - long tp_ch_used; ///< value of 'cmdheight' when frame size was set + tabpage_T *tp_next; ///< next tabpage or NULL + frame_T *tp_topframe; ///< topframe for the windows + win_T *tp_curwin; ///< current window in this Tab page + win_T *tp_prevwin; ///< previous window in this Tab page + win_T *tp_firstwin; ///< first window in this Tab page + win_T *tp_lastwin; ///< last window in this Tab page + int64_t tp_old_Rows_avail; ///< ROWS_AVAIL when Tab page was left + int64_t tp_old_Columns; ///< Columns when Tab page was left, -1 when + ///< calling win_new_screen_cols() postponed + OptInt tp_ch_used; ///< value of 'cmdheight' when frame size was set diff_T *tp_first_diff; buf_T *(tp_diffbuf[DB_COUNT]); -- 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/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index f0fdf0a230..ebaad45960 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -28,7 +28,7 @@ typedef struct { #include "nvim/mapping_defs.h" #include "nvim/mark_defs.h" #include "nvim/marktree.h" -#include "nvim/option_defs.h" +#include "nvim/option_vars.h" #include "nvim/pos.h" #include "nvim/statusline_defs.h" #include "nvim/undo_defs.h" -- cgit From 2af9fac0a6ce3b01f22802511cf1ed7b0734cb2e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 17:38:05 +0800 Subject: refactor: align set_chars_option() with Vim (#25438) Needed for completion of 'listchars'/'fillchars' values. --- src/nvim/buffer_defs.h | 82 +++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ebaad45960..7cf28ee0ab 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -988,6 +988,45 @@ typedef struct { pos_T w_cursor_corr; // corrected cursor position } pos_save_T; +/// Characters from the 'listchars' option. +typedef struct { + int eol; + int ext; + int prec; + int nbsp; + int space; + int tab1; ///< first tab character + int tab2; ///< second tab character + int tab3; ///< third tab character + int lead; + int trail; + int *multispace; + int *leadmultispace; + int conceal; +} lcs_chars_T; + +/// Characters from the 'fillchars' option. +typedef struct { + int stl; + int stlnc; + int wbr; + int horiz; + int horizup; + int horizdown; + int vert; + int vertleft; + int vertright; + int verthoriz; + int fold; + int foldopen; ///< when fold is open + int foldclosed; ///< when fold is closed + int foldsep; ///< continuous fold marker + int diff; + int msgsep; + int eob; + int lastline; +} fcs_chars_T; + /// Structure which contains all information that belongs to a window. /// /// All row numbers are relative to the start of the window, except w_winrow. @@ -1043,44 +1082,11 @@ struct window_S { linenr_T w_last_cursor_lnum_rnu; ///< cursor lnum when 'rnu' was last redrawn - // 'listchars' characters. Defaults set in set_chars_option(). - struct { - int eol; - int ext; - int prec; - int nbsp; - int space; - int tab1; ///< first tab character - int tab2; ///< second tab character - int tab3; ///< third tab character - int lead; - int trail; - int *multispace; - int *leadmultispace; - int conceal; - } w_p_lcs_chars; - - // 'fillchars' characters. Defaults set in set_chars_option(). - struct { - int stl; - int stlnc; - int wbr; - int horiz; - int horizup; - int horizdown; - int vert; - int vertleft; - int vertright; - int verthoriz; - int fold; - int foldopen; ///< when fold is open - int foldclosed; ///< when fold is closed - int foldsep; ///< continuous fold marker - int diff; - int msgsep; - int eob; - int lastline; - } w_p_fcs_chars; + /// 'listchars' characters. Defaults set in set_chars_option(). + lcs_chars_T w_p_lcs_chars; + + /// 'fillchars' characters. Defaults set in set_chars_option(). + fcs_chars_T w_p_fcs_chars; // "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for // displaying the buffer. -- cgit From 4200a0f1678c06c6da4e4cfb0184c29c1174ed21 Mon Sep 17 00:00:00 2001 From: glepnir Date: Wed, 27 Sep 2023 17:23:42 +0800 Subject: feat(float): support toggle show float window --- src/nvim/buffer_defs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index ff0fca1a56..562e0ba089 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -967,6 +967,7 @@ typedef struct { int footer_width; bool noautocmd; bool fixed; + bool hide; } FloatConfig; #define FLOAT_CONFIG_INIT ((FloatConfig){ .height = 0, .width = 0, \ @@ -977,6 +978,7 @@ typedef struct { .zindex = kZIndexFloatDefault, \ .style = kWinStyleUnused, \ .noautocmd = false, \ + .hide = false, \ .fixed = false }) // Structure to store last cursor position and topline. Used by check_lnums() -- 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/buffer_defs.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index a9ad0051ed..1a2e2fbdae 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -488,13 +488,13 @@ struct file_buffer { u_header_T *b_u_newhead; // pointer to newest header; may not be valid // if b_u_curhead is not NULL u_header_T *b_u_curhead; // pointer to current header - int b_u_numhead; // current number of headers - bool b_u_synced; // entry lists are synced - long b_u_seq_last; // last used undo sequence number - long b_u_save_nr_last; // counter for last file write - long b_u_seq_cur; // uh_seq of header below which we are now - time_t b_u_time_cur; // uh_time of header below which we are now - long b_u_save_nr_cur; // file write nr after which we are now + int b_u_numhead; // current number of headers + bool b_u_synced; // entry lists are synced + int b_u_seq_last; // last used undo sequence number + int b_u_save_nr_last; // counter for last file write + int b_u_seq_cur; // uh_seq of header below which we are now + time_t b_u_time_cur; // uh_time of header below which we are now + int b_u_save_nr_cur; // file write nr after which we are now // variables for "U" command in undo.c char *b_u_line_ptr; // saved line for "U" command -- 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/buffer_defs.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 1a2e2fbdae..5b223daeb0 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -274,8 +274,8 @@ typedef struct qf_info_S qf_info_T; typedef struct { proftime_T total; // total time used proftime_T slowest; // time of slowest call - long count; // nr of times used - long match; // nr of times matched + int count; // nr of times used + int match; // nr of times matched } syn_time_T; // These are items normally related to a buffer. But when using ":ownsyntax" @@ -440,10 +440,10 @@ struct file_buffer { disptick_T b_mod_tick_decor; // last display tick decoration providers // where invoked - long b_mtime; // last change time of original file - long b_mtime_ns; // nanoseconds of last change time - long b_mtime_read; // last change time when reading - long b_mtime_read_ns; // nanoseconds of last read time + int64_t b_mtime; // last change time of original file + int64_t b_mtime_ns; // nanoseconds of last change time + int64_t b_mtime_read; // last change time when reading + int64_t b_mtime_read_ns; // nanoseconds of last read time uint64_t b_orig_size; // size of original file in bytes int b_orig_mode; // mode of original file time_t b_last_used; // time when the buffer was last used; used @@ -1268,7 +1268,7 @@ struct window_S { int w_briopt_list; // additional indent for lists int w_briopt_vcol; // indent for specific column - long w_scbind_pos; + int w_scbind_pos; ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary. dict_T *w_vars; ///< Dictionary with w: variables. -- 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/buffer_defs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 5b223daeb0..812ac60eb0 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -361,7 +361,7 @@ typedef struct { #define BUF_UPDATE_CALLBACKS_INIT { LUA_NOREF, LUA_NOREF, LUA_NOREF, \ LUA_NOREF, LUA_NOREF, false, false } -EXTERN int curbuf_splice_pending INIT(= 0); +EXTERN int curbuf_splice_pending INIT( = 0); #define BUF_HAS_QF_ENTRY 1 #define BUF_HAS_LL_ENTRY 2 @@ -913,7 +913,7 @@ enum { // NE -> kFloatAnchorEast // SW -> kFloatAnchorSouth // SE -> kFloatAnchorSouth | kFloatAnchorEast -EXTERN const char *const float_anchor_str[] INIT(= { "NW", "NE", "SW", "SE" }); +EXTERN const char *const float_anchor_str[] INIT( = { "NW", "NE", "SW", "SE" }); typedef enum { kFloatRelativeEditor = 0, @@ -922,8 +922,8 @@ typedef enum { kFloatRelativeMouse = 3, } FloatRelative; -EXTERN const char *const float_relative_str[] INIT(= { "editor", "win", - "cursor", "mouse" }); +EXTERN const char *const float_relative_str[] INIT( = { "editor", "win", + "cursor", "mouse" }); typedef enum { kWinStyleUnused = 0, -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/buffer_defs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 812ac60eb0..cf77cea621 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_BUFFER_DEFS_H -#define NVIM_BUFFER_DEFS_H +#pragma once #include #include @@ -1340,5 +1339,3 @@ struct window_S { #define CHANGEDTICK(buf) \ (=== Include buffer.h & use buf_(get|set|inc) _changedtick ===) // uncrustify:on - -#endif // NVIM_BUFFER_DEFS_H -- cgit From 931f28841c46015cda70909917b4202e7c746492 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Nov 2023 11:50:04 +0800 Subject: refactor: remove B_SPELL macro (#26063) --- src/nvim/buffer_defs.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index cf77cea621..32ebe52018 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -264,9 +264,6 @@ struct wininfo_S { #define SYNFLD_START 0 // use level of item at start of line #define SYNFLD_MINIMUM 1 // use lowest local minimum level on line -// avoid #ifdefs for when b_spell is not available -#define B_SPELL(buf) ((buf)->b_spell) - typedef struct qf_info_S qf_info_T; // Used for :syntime: timing of executing a syntax pattern. @@ -695,8 +692,7 @@ struct file_buffer { bool b_help; // true for help file buffer (when set b_p_bt // is "help") bool b_spell; // True for a spell file buffer, most fields - // are not used! Use the B_SPELL macro to - // access b_spell without #ifdef. + // are not used! char *b_prompt_text; // set by prompt_setprompt() Callback b_prompt_callback; // set by prompt_setcallback() -- cgit From c4afb9788c4f139eb2e3b7aa4d6a6a20b67ba156 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 11 Nov 2023 00:52:50 +0100 Subject: refactor(sign): move legacy signs to extmarks Problem: The legacy signlist data structures and associated functions are redundant since the introduction of extmark signs. Solution: Store signs defined through the legacy commands in a hashmap, placed signs in the extmark tree. Replace signlist associated functions. Usage of the legacy sign commands should yield no change in behavior with the exception of: - "orphaned signs" are now always removed when the line it is placed on is deleted. This used to depend on the value of 'signcolumn'. - It is no longer possible to place multiple signs with the same identifier in a single group on multiple lines. This will now move the sign instead. Moreover, both signs placed through the legacy sign commands and through |nvim_buf_set_extmark()|: - Will show up in both |sign-place| and |nvim_buf_get_extmarks()|. - Are displayed by increasing sign identifier, left to right. Extmark signs used to be ordered decreasingly as opposed to legacy signs. --- src/nvim/buffer_defs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index cf77cea621..73fad15239 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -708,7 +708,6 @@ struct file_buffer { // normally points to this, but some windows // may use a different synblock_T. - sign_entry_T *b_signlist; // list of placed signs struct { int size; // last calculated number of sign columns bool valid; // calculated sign columns is valid -- cgit From 585eeacb24e1aa0fed978e46063de100b16b8bdf Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 20 Nov 2023 02:27:16 +0100 Subject: refactor(sign): store 'signcolumn' width range when it is set Problem: Minimum and maximum signcolumn width is determined each redraw. Solution: Determine and store 'signcolumn' range when option is set. --- src/nvim/buffer_defs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 039484d2e2..21cbefdb90 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1206,6 +1206,8 @@ struct window_S { int w_nrwidth; // width of 'number' and 'relativenumber' // column being used int w_scwidth; // width of 'signcolumn' + int w_minscwidth; // minimum width or SCL_NO/SCL_NUM + int w_maxscwidth; // maximum width or SCL_NO/SCL_NUM // === end of cached values === -- cgit From 6361806aa28edca55ad3316a58bc3e936df9c0eb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Nov 2023 22:58:52 +0800 Subject: refactor: move garray_T to garray_defs.h (#26227) --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 21cbefdb90..803d2aa0c6 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -19,7 +19,7 @@ typedef struct { #include "nvim/arglist_defs.h" #include "nvim/eval/typval_defs.h" #include "nvim/extmark_defs.h" -#include "nvim/garray.h" +#include "nvim/garray_defs.h" #include "nvim/grid_defs.h" #include "nvim/hashtab.h" #include "nvim/highlight_defs.h" -- cgit From 40139738eb479d0913ec6ce751ca5adfa50ad8c3 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 26 Nov 2023 21:36:02 +0100 Subject: build: enable IWYU on mac --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 803d2aa0c6..0e7e5723cd 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -4,7 +4,7 @@ #include #include -typedef struct file_buffer buf_T; // Forward declaration +typedef struct file_buffer buf_T; /// Reference to a buffer that stores the value of buf_free_count. /// bufref_valid() only needs to check "buf" when the count differs. -- 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/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 0e7e5723cd..d3b80c8891 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -28,7 +28,7 @@ typedef struct { #include "nvim/mark_defs.h" #include "nvim/marktree.h" #include "nvim/option_vars.h" -#include "nvim/pos.h" +#include "nvim/pos_defs.h" #include "nvim/statusline_defs.h" #include "nvim/undo_defs.h" -- cgit From 1a8f60c7d2699826b51f23b040b83b1d96a14930 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Nov 2023 10:47:22 +0800 Subject: refactor: move hashtab types to hashtab_defs.h (#26262) --- src/nvim/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d3b80c8891..0269060c2f 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -21,7 +21,7 @@ typedef struct { #include "nvim/extmark_defs.h" #include "nvim/garray_defs.h" #include "nvim/grid_defs.h" -#include "nvim/hashtab.h" +#include "nvim/hashtab_defs.h" #include "nvim/highlight_defs.h" #include "nvim/map.h" #include "nvim/mapping_defs.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/buffer_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 0269060c2f..e0119d2add 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -23,7 +23,7 @@ typedef struct { #include "nvim/grid_defs.h" #include "nvim/hashtab_defs.h" #include "nvim/highlight_defs.h" -#include "nvim/map.h" +#include "nvim/map_defs.h" #include "nvim/mapping_defs.h" #include "nvim/mark_defs.h" #include "nvim/marktree.h" -- cgit From f4001d27efae44c6c07678ad2c72eed5f1a25ea8 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 28 Nov 2023 05:40:18 +0100 Subject: perf(column): only invalidate lines affected by added sign --- src/nvim/buffer_defs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/buffer_defs.h') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index e0119d2add..e59539f900 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -706,9 +706,10 @@ struct file_buffer { struct { int size; // last calculated number of sign columns - bool valid; // calculated sign columns is valid + int max; // maximum value size is valid for. linenr_T sentinel; // a line number which is holding up the signcolumn - int max; // Maximum value size is valid for. + linenr_T invalid_top; // first invalid line number that needs to be checked + linenr_T invalid_bot; // last invalid line number that needs to be checked } b_signcols; Terminal *terminal; // Terminal instance associated with the buffer -- cgit