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/statusline_defs.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'src/nvim/statusline_defs.h') diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h index eac9dfd690..6835d62cdd 100644 --- a/src/nvim/statusline_defs.h +++ b/src/nvim/statusline_defs.h @@ -3,7 +3,10 @@ #include +#include "nvim/fold_defs.h" #include "nvim/macros.h" +#include "nvim/os/os_defs.h" +#include "nvim/sign_defs.h" /// Status line click definition typedef struct { @@ -23,4 +26,54 @@ typedef struct { const char *start; ///< Location where region starts. } 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 -- cgit From f0ac91c58b42ed4f38dea7352d89fd39a88142f4 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 1 Apr 2023 14:58:52 +0200 Subject: feat(api): evaluate 'statuscolumn' with nvim_eval_statusline() --- src/nvim/statusline_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/statusline_defs.h') diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h index 6835d62cdd..a9483216de 100644 --- a/src/nvim/statusline_defs.h +++ b/src/nvim/statusline_defs.h @@ -62,8 +62,8 @@ 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 num_attr; ///< default highlight attr + int sign_cul_id; ///< cursorline sign highlight id int truncate; ///< truncated width bool draw; ///< whether to draw the statuscolumn bool use_cul; ///< whether to use cursorline attrs -- 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/statusline_defs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/statusline_defs.h') diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h index a9483216de..f502f33c49 100644 --- a/src/nvim/statusline_defs.h +++ b/src/nvim/statusline_defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_STATUSLINE_DEFS_H -#define NVIM_STATUSLINE_DEFS_H +#pragma once #include @@ -75,5 +74,3 @@ struct statuscol { foldinfo_T foldinfo; ///< fold information SignTextAttrs *sattrs; ///< sign attributes }; - -#endif // NVIM_STATUSLINE_DEFS_H -- cgit From 574d25642fc9ca65b396633aeab6e2d32778b642 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 17:21:58 +0800 Subject: refactor: move Arena and ArenaMem to memory_defs.h (#26240) --- src/nvim/statusline_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/statusline_defs.h') diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h index f502f33c49..e0beff9528 100644 --- a/src/nvim/statusline_defs.h +++ b/src/nvim/statusline_defs.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "nvim/fold_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/statusline_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/statusline_defs.h') diff --git a/src/nvim/statusline_defs.h b/src/nvim/statusline_defs.h index e0beff9528..c1a54f4f54 100644 --- a/src/nvim/statusline_defs.h +++ b/src/nvim/statusline_defs.h @@ -4,7 +4,7 @@ #include #include "nvim/fold_defs.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/os/os_defs.h" #include "nvim/sign_defs.h" -- cgit