refactor(statusline): move statusline defs to statusline_defs.h

This commit is contained in:
Luuk van Baal 2023-02-04 11:05:24 +01:00
parent 08fb3b5309
commit a4e376f09b
2 changed files with 53 additions and 51 deletions

View File

@ -18,7 +18,6 @@ typedef struct {
#include "klib/kvec.h" #include "klib/kvec.h"
#include "nvim/api/private/defs.h" #include "nvim/api/private/defs.h"
#include "nvim/eval/typval.h" #include "nvim/eval/typval.h"
#include "nvim/fold_defs.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/grid_defs.h" #include "nvim/grid_defs.h"
#include "nvim/hashtab.h" #include "nvim/hashtab.h"
@ -338,36 +337,6 @@ struct mapblock {
bool m_replace_keycodes; // replace keycodes in result of expression 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 // values for b_syn_spell: what to do with toplevel text
#define SYNSPL_DEFAULT 0 // spell check if @Spell not defined #define SYNSPL_DEFAULT 0 // spell check if @Spell not defined
#define SYNSPL_TOP 1 // spell check toplevel text #define SYNSPL_TOP 1 // spell check toplevel text
@ -1417,26 +1386,6 @@ struct window_S {
size_t w_statuscol_click_defs_size; 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 /// Macros defined in Vim, but not in Neovim
// uncrustify:off // uncrustify:off
#define CHANGEDTICK(buf) \ #define CHANGEDTICK(buf) \

View File

@ -3,7 +3,10 @@
#include <stddef.h> #include <stddef.h>
#include "nvim/fold_defs.h"
#include "nvim/macros.h" #include "nvim/macros.h"
#include "nvim/os/os_defs.h"
#include "nvim/sign_defs.h"
/// Status line click definition /// Status line click definition
typedef struct { typedef struct {
@ -23,4 +26,54 @@ typedef struct {
const char *start; ///< Location where region starts. const char *start; ///< Location where region starts.
} StlClickRecord; } StlClickRecord;
/// 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;
};
/// 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
};
#endif // NVIM_STATUSLINE_DEFS_H #endif // NVIM_STATUSLINE_DEFS_H