diff options
Diffstat (limited to 'src/nvim/buffer_defs.h')
| -rw-r--r-- | src/nvim/buffer_defs.h | 140 |
1 files changed, 81 insertions, 59 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 48cef9b1e7..5e28a7b513 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -388,24 +388,25 @@ typedef struct { * 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 */ - int b_syn_error; /* TRUE when error occurred in HL */ - int b_syn_ic; /* ignore case for :syn cmds */ - int b_syn_spell; /* SYNSPL_ values */ - garray_T b_syn_patterns; /* table for syntax patterns */ - 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 - "containedin" argument */ - int b_syn_sync_flags; /* flags about how to sync */ - short b_syn_sync_id; /* group to sync on */ - long b_syn_sync_minlines; /* minimal sync lines offset */ - long b_syn_sync_maxlines; /* maximal sync lines offset */ - long b_syn_sync_linebreaks; /* offset for multi-line pattern */ - char_u *b_syn_linecont_pat; /* line continuation pattern */ - regprog_T *b_syn_linecont_prog; /* line continuation program */ + hashtab_T b_keywtab; // syntax keywords hash table + hashtab_T b_keywtab_ic; // idem, ignore case + int b_syn_error; // TRUE when error occurred in HL + bool b_syn_slow; // true when 'redrawtime' reached + int b_syn_ic; // ignore case for :syn cmds + int b_syn_spell; // SYNSPL_ values + garray_T b_syn_patterns; // table for syntax patterns + 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 + // "containedin" argument + int b_syn_sync_flags; // flags about how to sync + int16_t b_syn_sync_id; // group to sync on + long b_syn_sync_minlines; // minimal sync lines offset + long b_syn_sync_maxlines; // maximal sync lines offset + long b_syn_sync_linebreaks; // offset for multi-line pattern + char_u *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 */ int b_syn_topgrp; /* for ":syntax include" */ @@ -778,7 +779,9 @@ struct file_buffer { * normally points to this, but some windows * may use a different synblock_T. */ - signlist_T *b_signlist; /* list of signs to draw */ + signlist_T *b_signlist; // list of signs to draw + int b_signcols_max; // cached maximum number of sign columns + int b_signcols; // last calculated number of sign columns Terminal *terminal; // Terminal instance associated with the buffer @@ -958,24 +961,32 @@ struct matchitem { int conceal_char; ///< cchar for Conceal highlighting }; -typedef enum { - kFloatAnchorEast = 1, - kFloatAnchorSouth = 2, +typedef int FloatAnchor; +typedef int FloatRelative; - kFloatAnchorNW = 0, - kFloatAnchorNE = 1, - kFloatAnchorSW = 2, - kFloatAnchorSE = 3, -} FloatAnchor; +enum { + kFloatAnchorEast = 1, + kFloatAnchorSouth = 2, +}; + +// NW -> 0 +// NE -> kFloatAnchorEast +// SW -> kFloatAnchorSouth +// SE -> kFloatAnchorSouth | kFloatAnchorEast +EXTERN const char *const float_anchor_str[] INIT(= { "NW", "NE", "SW", "SE" }); + +enum { + kFloatRelativeEditor = 0, + kFloatRelativeWindow = 1, + kFloatRelativeCursor = 2, +}; -typedef enum { - kFloatRelativeEditor = 0, - kFloatRelativeWindow = 1, - kFloatRelativeCursor = 2, -} FloatRelative; +EXTERN const char *const float_relative_str[] INIT(= { "editor", "window", + "cursor" }); typedef struct { Window window; + int height, width; double row, col; FloatAnchor anchor; FloatRelative relative; @@ -983,22 +994,31 @@ typedef struct { bool focusable; } FloatConfig; -#define FLOAT_CONFIG_INIT ((FloatConfig){ .row = 0, .col = 0, .anchor = 0, \ +#define FLOAT_CONFIG_INIT ((FloatConfig){ .height = 0, .width = 0, \ + .row = 0, .col = 0, .anchor = 0, \ .relative = 0, .external = false, \ .focusable = true }) -/* - * Structure which contains all information that belongs to a window - * - * All row numbers are relative to the start of the window, except w_winrow. - */ +// Structure to store last cursor position and topline. Used by check_lnums() +// and reset_lnums(). +typedef struct +{ + int w_topline_save; // original topline value + int w_topline_corr; // corrected topline value + pos_T w_cursor_save; // original cursor position + pos_T w_cursor_corr; // corrected cursor position +} pos_save_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. struct window_S { handle_T handle; ///< unique identifier for the window buf_T *w_buffer; ///< buffer we are a window into (used ///< often, keep it the first item!) - synblock_T *w_s; /* for :ownsyntax */ + synblock_T *w_s; ///< for :ownsyntax int w_hl_id_normal; ///< 'winhighlight' normal id int w_hl_attr_normal; ///< 'winhighlight' normal final attrs @@ -1008,24 +1028,25 @@ struct window_S { int w_hl_needs_update; ///< attrs need to be recalculated - 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. */ + 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. - frame_T *w_frame; /* frame containing this window */ + frame_T *w_frame; ///< frame containing this window - pos_T w_cursor; /* cursor position in buffer */ + pos_T w_cursor; ///< cursor position in buffer - colnr_T w_curswant; /* The column we'd like to be at. This is - used to try to stay in the same column - for up/down cursor motions. */ + 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. int w_set_curswant; // If set, then update w_curswant the next // time through cursupdate() to the // current virtual column 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 @@ -1080,17 +1101,18 @@ struct window_S { colnr_T w_skipcol; /* starting column when a single line doesn't fit in the window */ - /* - * Layout of the window in the screen. - * May need to add "msg_scrolled" to "w_winrow" in rare situations. - */ - int w_winrow; /* first row of window in screen */ - int w_height; /* number of rows in window, excluding - status/command line(s) */ - int w_status_height; /* number of status lines (0 or 1) */ - int w_wincol; /* Leftmost column of window in screen. */ - int w_width; /* Width of window, excluding separation. */ - int w_vsep_width; /* Number of separator columns (0 or 1). */ + // + // Layout of the window in the screen. + // May need to add "msg_scrolled" to "w_winrow" in rare situations. + // + int w_winrow; // first row of window in screen + int w_height; // number of rows in window, excluding + // status/command line(s) + int w_status_height; // number of status lines (0 or 1) + int w_wincol; // Leftmost column of window in screen. + int w_width; // Width of window, excluding separation. + int w_vsep_width; // Number of separator columns (0 or 1). + pos_save_T w_save_cursor; // backup of cursor pos and topline // inner size of window, which can be overridden by external UI int w_height_inner; |