diff options
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r-- | src/nvim/buffer_defs.h | 178 |
1 files changed, 78 insertions, 100 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index e59539f900..9653b5e09c 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -4,7 +4,15 @@ #include <stdint.h> #include <stdio.h> -typedef struct file_buffer buf_T; +#include "nvim/arglist_defs.h" +#include "nvim/grid_defs.h" +#include "nvim/mapping_defs.h" +#include "nvim/marktree_defs.h" +#include "nvim/memline_defs.h" +#include "nvim/option_defs.h" +#include "nvim/os/fs_defs.h" +#include "nvim/statusline_defs.h" +#include "nvim/undo_defs.h" /// Reference to a buffer that stores the value of buf_free_count. /// bufref_valid() only needs to check "buf" when the count differs. @@ -14,24 +22,6 @@ typedef struct { int br_buf_free_count; } bufref_T; -#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_defs.h" -#include "nvim/grid_defs.h" -#include "nvim/hashtab_defs.h" -#include "nvim/highlight_defs.h" -#include "nvim/map_defs.h" -#include "nvim/mapping_defs.h" -#include "nvim/mark_defs.h" -#include "nvim/marktree.h" -#include "nvim/option_vars.h" -#include "nvim/pos_defs.h" -#include "nvim/statusline_defs.h" -#include "nvim/undo_defs.h" - #define GETFILE_SUCCESS(x) ((x) <= 0) #define MODIFIABLE(buf) (buf->b_p_ma) @@ -80,20 +70,12 @@ typedef struct { // Mask to check for flags that prevent normal writing #define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR) -typedef struct window_S win_T; typedef struct wininfo_S wininfo_T; typedef struct frame_S frame_T; typedef uint64_t disptick_T; // display tick type -#include "nvim/memline_defs.h" -#include "nvim/os/fs_defs.h" -#include "nvim/regexp_defs.h" -#include "nvim/sign_defs.h" -#include "nvim/syntax_defs.h" -#include "nvim/terminal.h" - // The taggy struct is used to store the information about a :tag command. -typedef struct taggy { +typedef struct { char *tagname; // tag name fmark_T fmark; // cursor position BEFORE ":tag" int cur_match; // match number @@ -357,8 +339,6 @@ 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); - #define BUF_HAS_QF_ENTRY 1 #define BUF_HAS_LL_ENTRY 2 @@ -548,6 +528,7 @@ struct file_buffer { Callback b_ofu_cb; ///< 'omnifunc' callback char *b_p_tfu; ///< 'tagfunc' Callback b_tfu_cb; ///< 'tagfunc' callback + char *b_p_urf; ///< 'userregfunc' int b_p_eof; ///< 'endoffile' int b_p_eol; ///< 'endofline' int b_p_fixeol; ///< 'fixendofline' @@ -705,11 +686,12 @@ struct file_buffer { // may use a different synblock_T. struct { - int size; // last calculated number of sign columns - int max; // maximum value size is valid for. - linenr_T sentinel; // a line number which is holding up the signcolumn - 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 + int max; // maximum number of signs on a single line + int count[SIGN_SHOW_MAX]; // number of lines with number of signs + bool resized; // whether max changed at start of redraw + bool autom; // whether 'signcolumn' is displayed in "auto:n>1" + // configured window. "b_signcols" calculation + // is skipped if false. } b_signcols; Terminal *terminal; // Terminal instance associated with the buffer @@ -720,10 +702,6 @@ 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 // array of channel_id:s which have asked to receive updates for this // buffer. @@ -736,7 +714,7 @@ struct file_buffer { // Measurements of the deleted or replaced region since the last update // event. Some consumers of buffer changes need to know the byte size (like - // tree-sitter) or the corresponding UTF-32/UTF-16 size (like LSP) of the + // treesitter) or the corresponding UTF-32/UTF-16 size (like LSP) of the // deleted text. size_t deleted_bytes; size_t deleted_bytes2; @@ -816,7 +794,7 @@ struct tabpage_S { // may not reflect what is actually in the buffer. When wl_valid is false, // the entries can only be used to count the number of displayed lines used. // wl_lnum and wl_lastlnum are invalid too. -typedef struct w_line { +typedef struct { linenr_T wl_lnum; // buffer line number for logical line uint16_t wl_size; // height in screen lines char wl_valid; // true values are valid for text in buffer @@ -904,12 +882,7 @@ enum { kFloatAnchorSouth = 2, }; -// NW -> 0 -// NE -> kFloatAnchorEast -// SW -> kFloatAnchorSouth -// SE -> kFloatAnchorSouth | kFloatAnchorEast -EXTERN const char *const float_anchor_str[] INIT( = { "NW", "NE", "SW", "SE" }); - +/// Keep in sync with float_relative_str[] in nvim_win_get_config() typedef enum { kFloatRelativeEditor = 0, kFloatRelativeWindow = 1, @@ -917,8 +890,13 @@ typedef enum { kFloatRelativeMouse = 3, } FloatRelative; -EXTERN const char *const float_relative_str[] INIT( = { "editor", "win", - "cursor", "mouse" }); +/// Keep in sync with win_split_str[] in nvim_win_get_config() (api/win_config.c) +typedef enum { + kWinSplitLeft = 0, + kWinSplitRight = 1, + kWinSplitAbove = 2, + kWinSplitBelow = 3, +} WinSplit; typedef enum { kWinStyleUnused = 0, @@ -936,6 +914,7 @@ typedef enum { kBorderTextFooter = 1, } BorderTextType; +/// See ":help nvim_open_win()" for documentation. typedef struct { Window window; lpos_T bufpos; @@ -945,6 +924,7 @@ typedef struct { FloatRelative relative; bool external; bool focusable; + WinSplit split; int zindex; WinStyle style; bool border; @@ -963,18 +943,19 @@ typedef struct { bool noautocmd; bool fixed; bool hide; -} FloatConfig; - -#define FLOAT_CONFIG_INIT ((FloatConfig){ .height = 0, .width = 0, \ - .bufpos = { -1, 0 }, \ - .row = 0, .col = 0, .anchor = 0, \ - .relative = 0, .external = false, \ - .focusable = true, \ - .zindex = kZIndexFloatDefault, \ - .style = kWinStyleUnused, \ - .noautocmd = false, \ - .hide = false, \ - .fixed = false }) +} WinConfig; + +#define WIN_CONFIG_INIT ((WinConfig){ .height = 0, .width = 0, \ + .bufpos = { -1, 0 }, \ + .row = 0, .col = 0, .anchor = 0, \ + .relative = 0, .external = false, \ + .focusable = true, \ + .split = 0, \ + .zindex = kZIndexFloatDefault, \ + .style = kWinStyleUnused, \ + .noautocmd = false, \ + .hide = false, \ + .fixed = false }) // Structure to store last cursor position and topline. Used by check_lnums() // and reset_lnums(). @@ -987,41 +968,41 @@ typedef struct { /// 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; + schar_T eol; + schar_T ext; + schar_T prec; + schar_T nbsp; + schar_T space; + schar_T tab1; ///< first tab character + schar_T tab2; ///< second tab character + schar_T tab3; ///< third tab character + schar_T lead; + schar_T trail; + schar_T *multispace; + schar_T *leadmultispace; + schar_T 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; + schar_T stl; + schar_T stlnc; + schar_T wbr; + schar_T horiz; + schar_T horizup; + schar_T horizdown; + schar_T vert; + schar_T vertleft; + schar_T vertright; + schar_T verthoriz; + schar_T fold; + schar_T foldopen; ///< when fold is open + schar_T foldclosed; ///< when fold is closed + schar_T foldsep; ///< continuous fold marker + schar_T diff; + schar_T msgsep; + schar_T eob; + schar_T lastline; } fcs_chars_T; /// Structure which contains all information that belongs to a window. @@ -1040,6 +1021,8 @@ struct window_S { int w_ns_hl_active; int *w_ns_hl_attr; + Set(uint32_t) w_ns_set; + int w_hl_id_normal; ///< 'winhighlight' normal id int w_hl_attr_normal; ///< 'winhighlight' normal final attrs int w_hl_attr_normalnc; ///< 'winhighlight' NormalNC final attrs @@ -1297,8 +1280,9 @@ struct window_S { ScreenGrid w_grid; // the grid specific to the window ScreenGrid w_grid_alloc; // the grid specific to the window bool w_pos_changed; // true if window position changed - bool w_floating; ///< whether the window is floating - FloatConfig w_float_config; + bool w_floating; ///< whether the window is floating + bool w_float_is_info; // the floating window is info float + WinConfig w_config; // w_fraction is the fractional row of the cursor within the window, from // 0 at the top row to FRACTION_MULT at the last row. @@ -1331,9 +1315,3 @@ struct window_S { // Size of the w_statuscol_click_defs array size_t w_statuscol_click_defs_size; }; - -/// Macros defined in Vim, but not in Neovim -// uncrustify:off -#define CHANGEDTICK(buf) \ - (=== Include buffer.h & use buf_(get|set|inc) _changedtick ===) -// uncrustify:on |