aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r--src/nvim/buffer_defs.h733
1 files changed, 349 insertions, 384 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 12ebd13439..fa76377c4e 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -3,11 +3,8 @@
#include <stdbool.h>
#include <stdint.h>
-// for FILE
#include <stdio.h>
-#include "grid_defs.h"
-
typedef struct file_buffer buf_T; // Forward declaration
// Reference to a buffer that stores the value of buf_free_count.
@@ -18,55 +15,44 @@ typedef struct {
int br_buf_free_count;
} bufref_T;
-// for garray_T
+#include "klib/kvec.h"
+#include "nvim/api/private/defs.h"
+#include "nvim/eval/typval.h"
#include "nvim/garray.h"
-// for ScreenGrid
#include "nvim/grid_defs.h"
-// for HLF_COUNT
-#include "nvim/highlight_defs.h"
-// for pos_T, lpos_T and linenr_T
-#include "nvim/pos.h"
-// for the number window-local and buffer-local options
-#include "nvim/option_defs.h"
-// for jump list and tag stack sizes in a buffer and mark types
-#include "nvim/mark_defs.h"
-// for u_header_T
-#include "nvim/undo_defs.h"
-// for hashtab_T
#include "nvim/hashtab.h"
-// for dict_T
-#include "nvim/eval/typval.h"
-// for String
-#include "nvim/api/private/defs.h"
-// for Map(K, V)
+#include "nvim/highlight_defs.h"
#include "nvim/map.h"
-// for kvec
-#include "nvim/lib/kvec.h"
-// for marktree
+#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"
+#include "nvim/undo_defs.h"
#define GETFILE_SUCCESS(x) ((x) <= 0)
#define MODIFIABLE(buf) (buf->b_p_ma)
-/*
- * Flags for w_valid.
- * These are set when something in a window structure becomes invalid, except
- * when the cursor is moved. Call check_cursor_moved() before testing one of
- * the flags.
- * These are reset when that thing has been updated and is valid again.
- *
- * Every function that invalidates one of these must call one of the
- * invalidate_* functions.
- *
- * w_valid is supposed to be used only in screen.c. From other files, use the
- * functions that set or reset the flags.
- *
- * VALID_BOTLINE VALID_BOTLINE_AP
- * on on w_botline valid
- * off on w_botline approximated
- * off off w_botline not valid
- * on off not possible
- */
+// Flags for w_valid.
+// These are set when something in a window structure becomes invalid, except
+// when the cursor is moved. Call check_cursor_moved() before testing one of
+// the flags.
+// These are reset when that thing has been updated and is valid again.
+//
+// Every function that invalidates one of these must call one of the
+// invalidate_* functions.
+//
+// w_valid is supposed to be used only in screen.c. From other files, use the
+// functions that set or reset the flags.
+//
+// VALID_BOTLINE VALID_BOTLINE_AP
+// on on w_botline valid
+// off on w_botline approximated
+// off off w_botline not valid
+// on off not possible
#define VALID_WROW 0x01 // w_wrow (window row) is valid
#define VALID_WCOL 0x02 // w_wcol (window col) is valid
#define VALID_VIRTCOL 0x04 // w_virtcol (file col) is valid
@@ -100,43 +86,32 @@ typedef struct wininfo_S wininfo_T;
typedef struct frame_S frame_T;
typedef uint64_t disptick_T; // display tick type
-// for struct memline (it needs memfile_T)
#include "nvim/memline_defs.h"
-
-// for regprog_T. Needs win_T and buf_T.
+#include "nvim/os/fs_defs.h"
#include "nvim/regexp_defs.h"
-// for synstate_T (needs reg_extmatch_T, win_T, buf_T)
-#include "nvim/syntax_defs.h"
-// for sign_entry_T
-#include "nvim/os/fs_defs.h" // for FileID
#include "nvim/sign_defs.h"
-#include "nvim/terminal.h" // for Terminal
+#include "nvim/syntax_defs.h"
+#include "nvim/terminal.h"
-/*
- * The taggy struct is used to store the information about a :tag command.
- */
+// The taggy struct is used to store the information about a :tag command.
typedef struct taggy {
- char_u *tagname; // tag name
+ char *tagname; // tag name
fmark_T fmark; // cursor position BEFORE ":tag"
int cur_match; // match number
int cur_fnum; // buffer number used for cur_match
- char_u *user_data; // used with tagfunc
+ 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
- */
+// structure used to store one block of the stuff/redo/recording buffers
struct buffblock {
buffblock_T *b_next; // pointer to next buffblock
- char_u b_str[1]; // contents (actually longer)
+ char b_str[1]; // contents (actually longer)
};
-/*
- * header used for the stuff buffer and the redo buffer
- */
+// 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
@@ -149,49 +124,47 @@ typedef struct {
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.
- */
+// 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.
typedef struct {
int wo_arab;
#define w_p_arab w_onebuf_opt.wo_arab // 'arabic'
int wo_bri;
#define w_p_bri w_onebuf_opt.wo_bri // 'breakindent'
- char_u *wo_briopt;
+ char *wo_briopt;
#define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt'
int wo_diff;
#define w_p_diff w_onebuf_opt.wo_diff // 'diff'
- char_u *wo_fdc;
+ char *wo_fdc;
#define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn'
- char_u *wo_fdc_save;
+ char *wo_fdc_save;
#define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'fdc' saved for diff mode
int wo_fen;
#define w_p_fen w_onebuf_opt.wo_fen // 'foldenable'
int wo_fen_save;
// 'foldenable' saved for diff mode
#define w_p_fen_save w_onebuf_opt.wo_fen_save
- char_u *wo_fdi;
+ char *wo_fdi;
#define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore'
long wo_fdl;
#define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel'
long wo_fdl_save;
// 'foldlevel' state saved for diff mode
#define w_p_fdl_save w_onebuf_opt.wo_fdl_save
- char_u *wo_fdm;
+ char *wo_fdm;
#define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod'
- char_u *wo_fdm_save;
+ char *wo_fdm_save;
#define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode
long wo_fml;
#define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines'
long wo_fdn;
#define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax'
- char_u *wo_fde;
+ char *wo_fde;
#define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr'
- char_u *wo_fdt;
+ char *wo_fdt;
#define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext'
- char_u *wo_fmr;
+ char *wo_fmr;
#define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker'
int wo_lbr;
#define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak'
@@ -201,7 +174,7 @@ typedef struct {
#define w_p_nu w_onebuf_opt.wo_nu // 'number'
int wo_rnu;
#define w_p_rnu w_onebuf_opt.wo_rnu // 'relativenumber'
- char_u *wo_ve;
+ char *wo_ve;
#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'
@@ -215,7 +188,7 @@ typedef struct {
#define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow'
int wo_rl;
#define w_p_rl w_onebuf_opt.wo_rl // 'rightleft'
- char_u *wo_rlc;
+ char *wo_rlc;
#define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd'
long wo_scr;
#define w_p_scr w_onebuf_opt.wo_scr // 'scroll'
@@ -225,13 +198,15 @@ typedef struct {
#define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn'
int wo_cul;
#define w_p_cul w_onebuf_opt.wo_cul // 'cursorline'
- char_u *wo_culopt;
+ char *wo_culopt;
#define w_p_culopt w_onebuf_opt.wo_culopt // 'cursorlineopt'
- char_u *wo_cc;
+ char *wo_cc;
#define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn'
- char_u *wo_sbr;
+ char *wo_sbr;
#define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak'
- char_u *wo_stl;
+ char *wo_stc;
+#define w_p_stc w_onebuf_opt.wo_stc // 'statuscolumn'
+ char *wo_stl;
#define w_p_stl w_onebuf_opt.wo_stl // 'statusline'
char *wo_wbr;
#define w_p_wbr w_onebuf_opt.wo_wbr // 'winbar'
@@ -245,7 +220,7 @@ typedef struct {
#define w_p_wrap w_onebuf_opt.wo_wrap // 'wrap'
int wo_wrap_save; // 'wrap' state saved for diff mode
#define w_p_wrap_save w_onebuf_opt.wo_wrap_save
- char_u *wo_cocu; // 'concealcursor'
+ char *wo_cocu; // 'concealcursor'
#define w_p_cocu w_onebuf_opt.wo_cocu
long wo_cole; // 'conceallevel'
#define w_p_cole w_onebuf_opt.wo_cole
@@ -253,14 +228,14 @@ typedef struct {
#define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind'
int wo_crb_save; // 'cursorbind' state saved for diff mode
#define w_p_crb_save w_onebuf_opt.wo_crb_save
- char_u *wo_scl;
+ char *wo_scl;
#define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn'
- char_u *wo_winhl;
+ char *wo_winhl;
#define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
- char_u *wo_fcs;
-#define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars'
- char_u *wo_lcs;
+ char *wo_lcs;
#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;
#define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend'
@@ -268,16 +243,14 @@ typedef struct {
#define w_p_script_ctx w_onebuf_opt.wo_script_ctx
} winopt_T;
-/*
- * Window info stored with a buffer.
- *
- * Two types of info are kept for a buffer which are associated with a
- * specific window:
- * 1. Each window can have a different line number associated with a buffer.
- * 2. The window-local options for a buffer work in a similar way.
- * The window-info is kept in a list at b_wininfo. It is kept in
- * most-recently-used order.
- */
+// Window info stored with a buffer.
+//
+// Two types of info are kept for a buffer which are associated with a
+// specific window:
+// 1. Each window can have a different line number associated with a buffer.
+// 2. The window-local options for a buffer work in a similar way.
+// The window-info is kept in a list at b_wininfo. It is kept in
+// most-recently-used order.
struct wininfo_S {
wininfo_T *wi_next; // next entry or NULL for last entry
wininfo_T *wi_prev; // previous entry or NULL for first entry
@@ -290,12 +263,10 @@ 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: move struct arglist to another header
- */
+// 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
@@ -308,8 +279,8 @@ typedef struct arglist {
//
// TODO(Felipe): move aentry_T to another header
typedef struct argentry {
- char_u *ae_fname; // file name as specified
- int ae_fnum; // buffer number with expanded file name
+ char *ae_fname; // file name as specified
+ int ae_fnum; // buffer number with expanded file name
} aentry_T;
#define ALIST(win) (win)->w_alist
@@ -321,12 +292,10 @@ 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.
- */
+// Used for the typeahead buffer: typebuf.
typedef struct {
- char_u *tb_buf; // buffer for typed characters
- char_u *tb_noremap; // mapping flags for characters in tb_buf[]
+ 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[]
@@ -347,16 +316,14 @@ typedef struct {
String save_inputbuf;
} tasave_T;
-/*
- * Structure used for mappings and abbreviations.
- */
+// Structure used for mappings and abbreviations.
typedef struct mapblock mapblock_T;
struct mapblock {
- mapblock_T *m_next; // next mapblock in list
- char_u *m_keys; // mapped from, lhs
- char_u *m_str; // mapped to, rhs
- char_u *m_orig_str; // rhs as entered by the user
- LuaRef m_luaref; // lua function reference as rhs
+ 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
@@ -366,8 +333,8 @@ struct mapblock {
char m_nowait; // <nowait> used
char m_expr; // <expr> used, m_str is an expression
sctx_T m_script_ctx; // SCTX where map was defined
- char *m_desc; // description of keymap
- bool m_replace_keycodes; // replace termcodes in lua function
+ char *m_desc; // description of mapping
+ bool m_replace_keycodes; // replace keycodes in result of expression
};
/// Used for highlighting in the status line.
@@ -414,9 +381,7 @@ struct stl_item {
typedef struct qf_info_S qf_info_T;
-/*
- * Used for :syntime: timing of executing a syntax pattern.
- */
+// Used for :syntime: timing of executing a syntax pattern.
typedef struct {
proftime_T total; // total time used
proftime_T slowest; // time of slowest call
@@ -424,10 +389,8 @@ typedef struct {
long match; // nr of times matched
} syn_time_T;
-/*
- * These are items normally related to a buffer. But when using ":ownsyntax"
- * a window may have its own instance.
- */
+// These are items normally related to a buffer. But when using ":ownsyntax"
+// a window may have its own instance.
typedef struct {
hashtab_T b_keywtab; // syntax keywords hash table
hashtab_T b_keywtab_ic; // idem, ignore case
@@ -440,14 +403,14 @@ typedef struct {
garray_T b_syn_clusters; // table for syntax clusters
int b_spell_cluster_id; // @Spell cluster ID or 0
int b_nospell_cluster_id; // @NoSpell cluster ID or 0
- int b_syn_containedin; // TRUE when there is an item with a
+ int b_syn_containedin; // true when there is an item with a
// "containedin" argument
int b_syn_sync_flags; // flags about how to sync
int16_t b_syn_sync_id; // group to sync on
linenr_T b_syn_sync_minlines; // minimal sync lines offset
linenr_T b_syn_sync_maxlines; // maximal sync lines offset
linenr_T b_syn_sync_linebreaks; // offset for multi-line pattern
- char_u *b_syn_linecont_pat; // line continuation pattern
+ char *b_syn_linecont_pat; // line continuation pattern
regprog_T *b_syn_linecont_prog; // line continuation program
syn_time_T b_syn_linecont_time;
int b_syn_linecont_ic; // ignore-case flag for above
@@ -476,17 +439,20 @@ typedef struct {
disptick_T b_sst_lasttick; // last display tick
// for spell checking
- garray_T b_langp; // list of pointers to slang_T, see spell.c
- bool b_spell_ismw[256]; // flags: is midword char
- char_u *b_spell_ismw_mb; // multi-byte midword chars
- char_u *b_p_spc; // 'spellcapcheck'
+ garray_T b_langp; // list of pointers to slang_T, see spell.c
+ bool b_spell_ismw[256]; // flags: is midword char
+ char *b_spell_ismw_mb; // multi-byte midword chars
+ char *b_p_spc; // 'spellcapcheck'
regprog_T *b_cap_prog; // program for 'spellcapcheck'
- char_u *b_p_spf; // 'spellfile'
- char_u *b_p_spl; // 'spelllang'
- char_u *b_p_spo; // 'spelloptions'
- int b_cjk; // all CJK letters as OK
- char_u b_syn_chartab[32]; // syntax iskeyword option
- char_u *b_syn_isk; // iskeyword option
+ char *b_p_spf; // 'spellfile'
+ char *b_p_spl; // 'spelllang'
+ char *b_p_spo; // 'spelloptions'
+#define SPO_CAMEL 0x1
+#define SPO_NPBUFFER 0x2
+ unsigned b_p_spo_flags; // 'spelloptions' flags
+ int b_cjk; // all CJK letters as OK
+ uint8_t b_syn_chartab[32]; // syntax iskeyword option
+ char *b_syn_isk; // iskeyword option
} synblock_T;
/// Type used for changedtick_di member in buf_T
@@ -514,13 +480,11 @@ EXTERN int curbuf_splice_pending INIT(= 0);
// Maximum number of maphash blocks we will have
#define MAX_MAPHASH 256
-/*
- * buffer: structure that holds information about one file
- *
- * Several windows can share a single Buffer
- * A buffer is unallocated if there is no memfile for it.
- * A buffer is new if the associated file has never been loaded yet.
- */
+// buffer: structure that holds information about one file
+//
+// Several windows can share a single Buffer
+// A buffer is unallocated if there is no memfile for it.
+// A buffer is new if the associated file has never been loaded yet.
struct file_buffer {
handle_T handle; // unique id for the buffer (buffer number)
@@ -570,15 +534,13 @@ struct file_buffer {
varnumber_T b_last_changedtick_pum; // b:changedtick when TextChangedP was
// last triggered.
- bool b_saving; /* Set to true if we are in the middle of
- saving the buffer. */
+ bool b_saving; // Set to true if we are in the middle of
+ // saving the buffer.
- /*
- * Changes to a buffer require updating of the display. To minimize the
- * work, remember changes made and update everything at once.
- */
- bool b_mod_set; /* true when there are changes since the last
- time the display was updated */
+ // Changes to a buffer require updating of the display. To minimize the
+ // work, remember changes made and update everything at once.
+ bool b_mod_set; // true when there are changes since the last
+ // time the display was updated
linenr_T b_mod_top; // topmost lnum that was changed
linenr_T b_mod_bot; // lnum below last changed line, AFTER the
// change
@@ -600,7 +562,7 @@ struct file_buffer {
fmark_T b_namedm[NMARKS]; // current named marks (mark.c)
- // These variables are set when VIsual_active becomes FALSE
+ // These variables are set when VIsual_active becomes false
visualinfo_T b_visual;
int b_visual_mode_eval; // b_visual.vi_mode for visualmode()
@@ -609,17 +571,13 @@ struct file_buffer {
fmark_T b_last_insert; // where Insert mode was left
fmark_T b_last_change; // position of last change: '. mark
- /*
- * the changelist contains old change positions
- */
+ // the changelist contains old change positions
fmark_T b_changelist[JUMPLISTSIZE];
int b_changelistlen; // number of active entries
bool b_new_change; // set by u_savecommon()
- /*
- * Character table, only used in charset.c for 'iskeyword'
- * bitset with 4*64=256 bits: 1 bit per character 0-255.
- */
+ // Character table, only used in charset.c for 'iskeyword'
+ // bitset with 4*64=256 bits: 1 bit per character 0-255.
uint64_t b_chartab[4];
// Table used for mappings local to a buffer.
@@ -629,18 +587,14 @@ struct file_buffer {
mapblock_T *b_first_abbr;
// User commands local to the buffer.
garray_T b_ucmds;
- /*
- * start and end of an operator, also used for '[ and ']
- */
+ // start and end of an operator, also used for '[ and ']
pos_T b_op_start;
pos_T b_op_start_orig; // used for Insstart_orig
pos_T b_op_end;
bool b_marks_read; // Have we read ShaDa marks yet?
- /*
- * The following only used in undo.c.
- */
+ // The following only used in undo.c.
u_header_T *b_u_oldhead; // pointer to oldest header
u_header_T *b_u_newhead; // pointer to newest header; may not be valid
// if b_u_curhead is not NULL
@@ -649,14 +603,12 @@ struct file_buffer {
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; // hu_seq of header below which we are now
+ 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
- /*
- * variables for "U" command in undo.c
- */
- char_u *b_u_line_ptr; // saved line for "U" command
+ // variables for "U" command in undo.c
+ char *b_u_line_ptr; // saved line for "U" command
linenr_T b_u_line_lnum; // line number of line in u_line
colnr_T b_u_line_colnr; // optional column number
@@ -675,84 +627,87 @@ struct file_buffer {
#define KEYMAP_LOADED 2 // 'keymap' mappings have been loaded
garray_T b_kmap_ga; // the keymap table
- /*
- * Options local to a buffer.
- * They are here because their value depends on the type of file
- * or contents of the file being edited.
- */
+ // Options local to a buffer.
+ // They are here because their value depends on the type of file
+ // or contents of the file being edited.
bool b_p_initialized; // set when options initialized
LastSet b_p_script_ctx[BV_COUNT]; // SCTXs for buffer-local options
int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode
- char_u *b_p_bkc; ///< 'backupco
+ char *b_p_bkc; ///< 'backupco
unsigned int b_bkc_flags; ///< flags for 'backupco
int b_p_ci; ///< 'copyindent'
int b_p_bin; ///< 'binary'
int b_p_bomb; ///< 'bomb'
- char_u *b_p_bh; ///< 'bufhidden'
- char_u *b_p_bt; ///< 'buftype'
+ char *b_p_bh; ///< 'bufhidden'
+ char *b_p_bt; ///< 'buftype'
int b_has_qf_entry; ///< quickfix exists for buffer
int b_p_bl; ///< 'buflisted'
long b_p_channel; ///< 'channel'
int b_p_cin; ///< 'cindent'
- char_u *b_p_cino; ///< 'cinoptions'
- char_u *b_p_cink; ///< 'cinkeys'
- char_u *b_p_cinw; ///< 'cinwords'
- char_u *b_p_cinsd; ///< 'cinscopedecls'
- char_u *b_p_com; ///< 'comments'
- char_u *b_p_cms; ///< 'commentstring'
- char_u *b_p_cpt; ///< 'complete'
+ char *b_p_cino; ///< 'cinoptions'
+ char *b_p_cink; ///< 'cinkeys'
+ char *b_p_cinw; ///< 'cinwords'
+ char *b_p_cinsd; ///< 'cinscopedecls'
+ char *b_p_com; ///< 'comments'
+ char *b_p_cms; ///< 'commentstring'
+ char *b_p_cpt; ///< 'complete'
#ifdef BACKSLASH_IN_FILENAME
- char_u *b_p_csl; ///< 'completeslash'
+ char *b_p_csl; ///< 'completeslash'
#endif
- char_u *b_p_cfu; ///< 'completefunc'
- char_u *b_p_ofu; ///< 'omnifunc'
- char_u *b_p_tfu; ///< 'tagfunc'
- char_u *b_p_umf; ///< 'usermarkfunc'
+ char *b_p_umf; ///< 'usermarkfunc'
+ char *b_p_cfu; ///< 'completefunc'
+ Callback b_cfu_cb; ///< 'completefunc' callback
+ char *b_p_ofu; ///< 'omnifunc'
+ Callback b_ofu_cb; ///< 'omnifunc' callback
+ char *b_p_tfu; ///< 'tagfunc'
+ Callback b_tfu_cb; ///< 'tagfunc' callback
+ int b_p_eof; ///< 'endoffile'
int b_p_eol; ///< 'endofline'
int b_p_fixeol; ///< 'fixendofline'
int b_p_et; ///< 'expandtab'
int b_p_et_nobin; ///< b_p_et saved for binary mode
int b_p_et_nopaste; ///< b_p_et saved for paste mode
- char_u *b_p_fenc; ///< 'fileencoding'
- char_u *b_p_ff; ///< 'fileformat'
- char_u *b_p_ft; ///< 'filetype'
- char_u *b_p_fo; ///< 'formatoptions'
- char_u *b_p_flp; ///< 'formatlistpat'
+ char *b_p_fenc; ///< 'fileencoding'
+ char *b_p_ff; ///< 'fileformat'
+ char *b_p_ft; ///< 'filetype'
+ char *b_p_fo; ///< 'formatoptions'
+ char *b_p_flp; ///< 'formatlistpat'
int b_p_inf; ///< 'infercase'
- char_u *b_p_isk; ///< 'iskeyword'
- char_u *b_p_def; ///< 'define' local value
- char_u *b_p_inc; ///< 'include'
- char_u *b_p_inex; ///< 'includeexpr'
+ char *b_p_isk; ///< 'iskeyword'
+ char *b_p_def; ///< 'define' local value
+ char *b_p_inc; ///< 'include'
+ char *b_p_inex; ///< 'includeexpr'
uint32_t b_p_inex_flags; ///< flags for 'includeexpr'
- char_u *b_p_inde; ///< 'indentexpr'
+ char *b_p_inde; ///< 'indentexpr'
uint32_t b_p_inde_flags; ///< flags for 'indentexpr'
- char_u *b_p_indk; ///< 'indentkeys'
- char_u *b_p_fp; ///< 'formatprg'
- char_u *b_p_fex; ///< 'formatexpr'
+ char *b_p_indk; ///< 'indentkeys'
+ char *b_p_fp; ///< 'formatprg'
+ char *b_p_fex; ///< 'formatexpr'
uint32_t b_p_fex_flags; ///< flags for 'formatexpr'
- char_u *b_p_kp; ///< 'keywordprg'
+ char *b_p_kp; ///< 'keywordprg'
int b_p_lisp; ///< 'lisp'
- char_u *b_p_menc; ///< 'makeencoding'
- char_u *b_p_mps; ///< 'matchpairs'
+ char *b_p_lop; ///< 'lispoptions'
+ char *b_p_menc; ///< 'makeencoding'
+ char *b_p_mps; ///< 'matchpairs'
int b_p_ml; ///< 'modeline'
int b_p_ml_nobin; ///< b_p_ml saved for binary mode
int b_p_ma; ///< 'modifiable'
- char_u *b_p_nf; ///< 'nrformats'
+ char *b_p_nf; ///< 'nrformats'
int b_p_pi; ///< 'preserveindent'
- char_u *b_p_qe; ///< 'quoteescape'
+ char *b_p_qe; ///< 'quoteescape'
int b_p_ro; ///< 'readonly'
long b_p_sw; ///< 'shiftwidth'
long 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
- char_u *b_p_sua; ///< 'suffixesadd'
+ char *b_p_sua; ///< 'suffixesadd'
int b_p_swf; ///< 'swapfile'
long b_p_smc; ///< 'synmaxcol'
- char_u *b_p_syn; ///< 'syntax'
+ 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
@@ -760,29 +715,30 @@ struct file_buffer {
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
- char_u *b_p_vsts; ///< 'varsofttabstop'
- long *b_p_vsts_array; ///< 'varsofttabstop' in internal format
- char_u *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode
- char_u *b_p_vts; ///< 'vartabstop'
- long *b_p_vts_array; ///< 'vartabstop' in internal format
- char_u *b_p_keymap; ///< 'keymap'
+ char *b_p_vsts; ///< 'varsofttabstop'
+ long *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
+ char *b_p_keymap; ///< 'keymap'
// local values for options which are normally global
- char_u *b_p_gp; ///< 'grepprg' local value
- char_u *b_p_mp; ///< 'makeprg' local value
- char_u *b_p_efm; ///< 'errorformat' local value
- char_u *b_p_ep; ///< 'equalprg' local value
- char_u *b_p_path; ///< 'path' local value
+ char *b_p_gp; ///< 'grepprg' local value
+ char *b_p_mp; ///< 'makeprg' local value
+ char *b_p_efm; ///< 'errorformat' local value
+ char *b_p_ep; ///< 'equalprg' local value
+ char *b_p_path; ///< 'path' local value
int b_p_ar; ///< 'autoread' local value
- char_u *b_p_tags; ///< 'tags' local value
- char_u *b_p_tc; ///< 'tagcase' local value
+ char *b_p_tags; ///< 'tags' local value
+ char *b_p_tc; ///< 'tagcase' local value
unsigned b_tc_flags; ///< flags for 'tagcase'
- char_u *b_p_dict; ///< 'dictionary' local value
- char_u *b_p_tsr; ///< 'thesaurus' local value
- char_u *b_p_tsrfu; ///< 'thesaurusfunc' local value
+ char *b_p_dict; ///< 'dictionary' local value
+ 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
int b_p_udf; ///< 'undofile'
- char_u *b_p_lw; ///< 'lispwords' local value
+ char *b_p_lw; ///< 'lispwords' local value
// end of buffer options
@@ -825,9 +781,10 @@ struct file_buffer {
int b_ind_cpp_extern_c;
int b_ind_pragma;
- linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary
- * write should not have an end-of-line */
+ linenr_T b_no_eol_lnum; // non-zero lnum when last line of next binary
+ // write should not have an end-of-line
+ int b_start_eof; // last line had eof (CTRL-Z) when it was read
int b_start_eol; // last line had eol when it was read
int b_start_ffc; // first char of 'ff' when edit started
char *b_start_fenc; // 'fileencoding' when edit started or NULL
@@ -837,20 +794,18 @@ struct file_buffer {
ScopeDictDictItem b_bufvar; ///< Variable for "b:" Dictionary.
dict_T *b_vars; ///< b: scope dictionary.
- /* When a buffer is created, it starts without a swap file. b_may_swap is
- * then set to indicate that a swap file may be opened later. It is reset
- * if a swap file could not be opened.
- */
+ // When a buffer is created, it starts without a swap file. b_may_swap is
+ // then set to indicate that a swap file may be opened later. It is reset
+ // if a swap file could not be opened.
bool b_may_swap;
- bool b_did_warn; /* Set to true if user has been warned on first
- change of a read-only file */
-
- /* Two special kinds of buffers:
- * help buffer - used for help files, won't use a swap file.
- * spell buffer - used for spell info, never displayed and doesn't have a
- * file name.
- */
- bool b_help; // TRUE for help file buffer (when set b_p_bt
+ bool b_did_warn; // Set to true if user has been warned on first
+ // change of a read-only file
+
+ // Two special kinds of buffers:
+ // help buffer - used for help files, won't use a swap file.
+ // spell buffer - used for spell info, never displayed and doesn't have a
+ // file name.
+ 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
@@ -909,30 +864,28 @@ struct file_buffer {
int b_diff_failed; // internal diff failed for this buffer
};
-/*
- * Stuff for diff mode.
- */
+// Stuff for diff mode.
#define DB_COUNT 8 // up to four buffers can be diff'ed
-/*
- * Each diffblock defines where a block of lines starts in each of the buffers
- * and how many lines it occupies in that buffer. When the lines are missing
- * in the buffer the df_count[] is zero. This is all counted in
- * buffer lines.
- * There is always at least one unchanged line in between the diffs.
- * Otherwise it would have been included in the diff above or below it.
- * df_lnum[] + df_count[] is the lnum below the change. When in one buffer
- * lines have been inserted, in the other buffer df_lnum[] is the line below
- * the insertion and df_count[] is zero. When appending lines at the end of
- * the buffer, df_lnum[] is one beyond the end!
- * This is using a linked list, because the number of differences is expected
- * to be reasonable small. The list is sorted on lnum.
- */
+// Each diffblock defines where a block of lines starts in each of the buffers
+// and how many lines it occupies in that buffer. When the lines are missing
+// in the buffer the df_count[] is zero. This is all counted in
+// buffer lines.
+// There is always at least one unchanged line in between the diffs.
+// Otherwise it would have been included in the diff above or below it.
+// df_lnum[] + df_count[] is the lnum below the change. When in one buffer
+// lines have been inserted, in the other buffer df_lnum[] is the line below
+// the insertion and df_count[] is zero. When appending lines at the end of
+// the buffer, df_lnum[] is one beyond the end!
+// This is using a linked list, because the number of differences is expected
+// to be reasonable small. The list is sorted on lnum.
typedef struct diffblock_S diff_T;
struct diffblock_S {
diff_T *df_next;
linenr_T df_lnum[DB_COUNT]; // line number in buffer
linenr_T df_count[DB_COUNT]; // nr of inserted/changed lines
+ bool is_linematched; // has the linematch algorithm ran on this diff hunk to divide it into
+ // smaller diff hunks?
};
#define SNAP_HELP_IDX 0
@@ -953,7 +906,8 @@ struct tabpage_S {
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
+ 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
diff_T *tp_first_diff;
@@ -967,30 +921,26 @@ struct tabpage_S {
char *tp_prevdir; ///< Previous directory.
};
-/*
- * Structure to cache info for displayed lines in w_lines[].
- * Each logical line has one entry.
- * The entry tells how the logical line is currently displayed in the window.
- * This is updated when displaying the window.
- * When the display is changed (e.g., when clearing the screen) w_lines_valid
- * is changed to exclude invalid entries.
- * When making changes to the buffer, wl_valid is reset to indicate wl_size
- * 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.
- */
+// Structure to cache info for displayed lines in w_lines[].
+// Each logical line has one entry.
+// The entry tells how the logical line is currently displayed in the window.
+// This is updated when displaying the window.
+// When the display is changed (e.g., when clearing the screen) w_lines_valid
+// is changed to exclude invalid entries.
+// When making changes to the buffer, wl_valid is reset to indicate wl_size
+// 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 {
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
- char wl_folded; // TRUE when this is a range of folded lines
+ char wl_valid; // true values are valid for text in buffer
+ char wl_folded; // true when this is a range of folded lines
linenr_T wl_lastlnum; // last buffer line number for logical line
} wline_T;
-/*
- * Windows are kept in a tree of frames. Each frame has a column (FR_COL)
- * or row (FR_ROW) layout or is a leaf, which has a window.
- */
+// Windows are kept in a tree of frames. Each frame has a column (FR_COL)
+// or row (FR_ROW) layout or is a leaf, which has a window.
struct frame_S {
char fr_layout; // FR_LEAF, FR_COL or FR_ROW
int fr_width;
@@ -1004,19 +954,18 @@ struct frame_S {
// for first
// fr_child and fr_win are mutually exclusive
frame_T *fr_child; // first contained frame
- win_T *fr_win; // window that fills this frame
+ win_T *fr_win; // window that fills this frame; for a snapshot
+ // set to the current window
};
#define FR_LEAF 0 // frame is a leaf
#define FR_ROW 1 // frame with a row of windows
#define FR_COL 2 // frame with a column of windows
-/*
- * Struct used for highlighting 'hlsearch' matches, matches defined by
- * ":match" and matches defined by match functions.
- * For 'hlsearch' there is one pattern for all windows. For ":match" and the
- * match functions there is a different pattern for each window.
- */
+// Struct used for highlighting 'hlsearch' matches, matches defined by
+// ":match" and matches defined by match functions.
+// For 'hlsearch' there is one pattern for all windows. For ":match" and the
+// match functions there is a different pattern for each window.
typedef struct {
regmmatch_T rm; // points to the regexp program; contains last found
// match (may continue in next line)
@@ -1032,9 +981,6 @@ typedef struct {
proftime_T tm; // for a time limit
} match_T;
-/// number of positions supported by matchaddpos()
-#define MAXPOSMATCH 8
-
/// Same as lpos_T, but with additional field len.
typedef struct {
linenr_T lnum; ///< line number
@@ -1042,31 +988,28 @@ typedef struct {
int len; ///< length: 0 - to the end of line
} llpos_T;
-/// posmatch_T provides an array for storing match items for matchaddpos()
-/// function.
-typedef struct posmatch posmatch_T;
-struct posmatch {
- llpos_T pos[MAXPOSMATCH]; ///< array of positions
- int cur; ///< internal position counter
- linenr_T toplnum; ///< top buffer line
- linenr_T botlnum; ///< bottom buffer line
-};
-
-/*
- * matchitem_T provides a linked list for storing match items for ":match" and
- * the match functions.
- */
+/// matchitem_T provides a linked list for storing match items for ":match",
+/// matchadd() and matchaddpos().
typedef struct matchitem matchitem_T;
struct matchitem {
- matchitem_T *next;
- int id; ///< match ID
- int priority; ///< match priority
- char *pattern; ///< pattern to highlight
- regmmatch_T match; ///< regexp program for pattern
- posmatch_T pos; ///< position matches
- match_T hl; ///< struct for doing the actual highlighting
- int hlg_id; ///< highlight group ID
- int conceal_char; ///< cchar for Conceal highlighting
+ matchitem_T *mit_next;
+ int mit_id; ///< match ID
+ int mit_priority; ///< match priority
+
+ // Either a pattern is defined (mit_pattern is not NUL) or a list of
+ // positions is given (mit_pos is not NULL and mit_pos_count > 0).
+ char *mit_pattern; ///< pattern to highlight
+ regmmatch_T mit_match; ///< regexp program for pattern
+
+ llpos_T *mit_pos_array; ///< array of positions
+ int mit_pos_count; ///< nr of entries in mit_pos
+ int mit_pos_cur; ///< internal position counter
+ linenr_T mit_toplnum; ///< top buffer line
+ linenr_T mit_botlnum; ///< bottom buffer line
+
+ match_T mit_hl; ///< struct for doing the actual highlighting
+ int mit_hlg_id; ///< highlight group ID
+ int mit_conceal_char; ///< cchar for Conceal highlighting
};
typedef int FloatAnchor;
@@ -1086,16 +1029,23 @@ typedef enum {
kFloatRelativeEditor = 0,
kFloatRelativeWindow = 1,
kFloatRelativeCursor = 2,
+ kFloatRelativeMouse = 3,
} FloatRelative;
EXTERN const char *const float_relative_str[] INIT(= { "editor", "win",
- "cursor" });
+ "cursor", "mouse" });
typedef enum {
kWinStyleUnused = 0,
kWinStyleMinimal, /// Minimal UI: no number column, eob markers, etc
} WinStyle;
+typedef enum {
+ kAlignLeft = 0,
+ kAlignCenter = 1,
+ kAlignRight = 2,
+} AlignTextPos;
+
typedef struct {
Window window;
lpos_T bufpos;
@@ -1108,10 +1058,14 @@ 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];
+ AlignTextPos title_pos;
+ VirtText title_chunks;
+ int title_width;
bool noautocmd;
} FloatConfig;
@@ -1222,16 +1176,15 @@ struct window_S {
int diff;
int msgsep;
int eob;
+ int lastline;
} w_p_fcs_chars;
- /*
- * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
- * displaying the buffer.
- */
- linenr_T w_topline; /* buffer line number of the line at the
- top of the window */
- char w_topline_was_set; /* flag set to TRUE when topline is set,
- e.g. by winrestview() */
+ // "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
+ // displaying the buffer.
+ linenr_T w_topline; // buffer line number of the line at the
+ // top of the window
+ char w_topline_was_set; // flag set to true when topline is set,
+ // e.g. by winrestview()
int w_topfill; // number of filler lines above w_topline
int w_old_topfill; // w_topfill at last redraw
bool w_botfill; // true when filler lines are actually
@@ -1243,9 +1196,11 @@ struct window_S {
colnr_T w_skipcol; // starting column when a single line
// doesn't fit in the window
- // four fields that are only used when there is a WinScrolled autocommand
+ // six fields that are only used when there is a WinScrolled autocommand
linenr_T w_last_topline; ///< last known value for w_topline
+ int w_last_topfill; ///< last known value for w_topfill
colnr_T w_last_leftcol; ///< last known value for w_leftcol
+ colnr_T w_last_skipcol; ///< last known value for w_skipcol
int w_last_width; ///< last known value for w_width
int w_last_height; ///< last known value for w_height
@@ -1256,6 +1211,8 @@ struct window_S {
int w_winrow; // first row of window in screen
int w_height; // number of rows in window, excluding
// status/command line(s)
+ int w_prev_winrow; // previous winrow used for 'splitkeep'
+ int w_prev_height; // previous height used for 'splitkeep'
int w_status_height; // number of status lines (0 or 1)
int w_winbar_height; // number of window bars (0 or 1)
int w_wincol; // Leftmost column of window in screen.
@@ -1281,26 +1238,20 @@ struct window_S {
int w_height_outer;
int w_width_outer;
- /*
- * === start of cached values ====
- */
- /*
- * Recomputing is minimized by storing the result of computations.
- * Use functions in screen.c to check if they are valid and to update.
- * w_valid is a bitfield of flags, which indicate if specific values are
- * valid or need to be recomputed.
- */
+ // === start of cached values ====
+
+ // Recomputing is minimized by storing the result of computations.
+ // Use functions in screen.c to check if they are valid and to update.
+ // w_valid is a bitfield of flags, which indicate if specific values are
+ // valid or need to be recomputed.
int w_valid;
- pos_T w_valid_cursor; /* last known position of w_cursor, used
- to adjust 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
bool w_viewport_invalid;
- /*
- * 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().
- */
+ // 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().
int w_cline_height; // current size of cursor line
bool w_cline_folded; // cursor line is folded
@@ -1313,11 +1264,9 @@ struct window_S {
// more than one screen line or when
// w_leftcol is non-zero
- /*
- * w_wrow and w_wcol specify the cursor position in the window.
- * This is related to positions in the window, not in the display or
- * buffer, thus w_wrow is relative to w_winrow.
- */
+ // w_wrow and w_wcol specify the cursor position in the window.
+ // This is related to positions in the window, not in the display or
+ // buffer, thus w_wrow is relative to w_winrow.
int w_wrow, w_wcol; // cursor position in window
linenr_T w_botline; // number of the line below the bottom of
@@ -1326,16 +1275,14 @@ struct window_S {
int w_filler_rows; // number of filler rows at the end of the
// window
- /*
- * Info about the lines currently in the window is remembered to avoid
- * recomputing it every time. The allocated size of w_lines[] is Rows.
- * Only the w_lines_valid entries are actually valid.
- * When the display is up-to-date w_lines[0].wl_lnum is equal to w_topline
- * and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
- * Between changing text and updating the display w_lines[] represents
- * what is currently displayed. wl_valid is reset to indicated this.
- * This is used for efficient redrawing.
- */
+ // Info about the lines currently in the window is remembered to avoid
+ // recomputing it every time. The allocated size of w_lines[] is Rows.
+ // Only the w_lines_valid entries are actually valid.
+ // When the display is up-to-date w_lines[0].wl_lnum is equal to w_topline
+ // and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
+ // Between changing text and updating the display w_lines[] represents
+ // what is currently displayed. wl_valid is reset to indicated this.
+ // This is used for efficient redrawing.
int w_lines_valid; // number of valid entries
wline_T *w_lines;
@@ -1348,17 +1295,16 @@ struct window_S {
// column being used
int w_scwidth; // width of 'signcolumn'
- /*
- * === end of cached values ===
- */
+ // === end of cached values ===
int w_redr_type; // type of redraw to be performed on win
int w_upd_rows; // number of window lines to update when
- // w_redr_type is REDRAW_TOP
+ // w_redr_type is UPD_REDRAW_TOP
linenr_T w_redraw_top; // when != 0: first line needing redraw
linenr_T w_redraw_bot; // when != 0: last line needing redraw
bool w_redr_status; // if true statusline/winbar must be redrawn
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
@@ -1366,7 +1312,7 @@ struct window_S {
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)
+ char w_ru_empty; // true if ruler shows 0-1 (empty line)
int w_alt_fnum; // alternate file (for # and CTRL-^)
@@ -1399,6 +1345,7 @@ struct window_S {
int w_briopt_shift; // additional shift for breakindent
bool w_briopt_sbr; // sbr in 'briopt'
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))
@@ -1408,17 +1355,13 @@ struct window_S {
ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary.
dict_T *w_vars; ///< Dictionary with w: variables.
- /*
- * The w_prev_pcmark field is used to check whether we really did jump to
- * a new line after setting the w_pcmark. If not, then we revert to
- * using the previous w_pcmark.
- */
+ // The w_prev_pcmark field is used to check whether we really did jump to
+ // a new line after setting the w_pcmark. If not, then we revert to
+ // using the previous w_pcmark.
pos_T w_pcmark; // previous context mark
pos_T w_prev_pcmark; // previous w_pcmark
- /*
- * the jumplist contains old cursor positions
- */
+ // the jumplist contains old cursor positions
xfmark_T w_jumplist[JUMPLISTSIZE];
int w_jumplistlen; // number of active entries
int w_jumplistidx; // current position
@@ -1428,12 +1371,10 @@ struct window_S {
matchitem_T *w_match_head; // head of match list
int w_next_match_id; // next match ID
- /*
- * the tagstack grows from 0 upwards:
- * entry 0: older
- * entry 1: newer
- * entry 2: newest
- */
+ // the tagstack grows from 0 upwards:
+ // entry 0: older
+ // entry 1: newer
+ // entry 2: newest
taggy_T w_tagstack[TAGSTACKSIZE]; // the tag stack
int w_tagstackidx; // idx just below active entry
int w_tagstacklen; // number of tags on stack
@@ -1444,17 +1385,14 @@ struct window_S {
bool w_floating; ///< whether the window is floating
FloatConfig w_float_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.
- * w_prev_fraction_row was the actual cursor row when w_fraction was last
- * calculated.
- */
+ // 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.
+ // w_prev_fraction_row was the actual cursor row when w_fraction was last
+ // calculated.
int w_fraction;
int w_prev_fraction_row;
- linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width
- * was computed. */
+ linenr_T w_nrwidth_line_count; // line count when ml_nrwidth_width was computed.
int w_nrwidth_width; // nr of chars to print line count.
qf_info_T *w_llist; // Location list for this window
@@ -1471,10 +1409,37 @@ struct window_S {
StlClickDefinition *w_winbar_click_defs;
// Size of the w_winbar_click_defs array
size_t w_winbar_click_defs_size;
+
+ // Status column click definitions
+ StlClickDefinition *w_statuscol_click_defs;
+ // Size of the w_statuscol_click_defs array
+ 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 fold_attr; ///< attributes used for fold column
+ int sign_attr[SIGN_SHOW_MAX + 1]; ///< attributes used for signs
+ 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)
+ 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
};
/// Macros defined in Vim, but not in Neovim
+// uncrustify:off
#define CHANGEDTICK(buf) \
(=== Include buffer.h & use buf_(get|set|inc) _changedtick ===)
+// uncrustify:on
-#endif // NVIM_BUFFER_DEFS_H
+#endif // NVIM_BUFFER_DEFS_H