aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-28 19:00:14 +0800
committerGitHub <noreply@github.com>2023-11-28 19:00:14 +0800
commitc9f53d0e40815644bbf7c57a0792f2c793c954aa (patch)
tree57493059df0a44da2a004a335e7eae95bdb240d5
parentba564442ae5e8793f54d401fc636194df48cad3d (diff)
downloadrneovim-c9f53d0e40815644bbf7c57a0792f2c793c954aa.tar.gz
rneovim-c9f53d0e40815644bbf7c57a0792f2c793c954aa.tar.bz2
rneovim-c9f53d0e40815644bbf7c57a0792f2c793c954aa.zip
refactor: iwyu (#26269)
-rw-r--r--src/nvim/api/ui.h2
-rw-r--r--src/nvim/buffer.h66
-rw-r--r--src/nvim/decoration.c3
-rw-r--r--src/nvim/mbyte.c1
-rw-r--r--src/nvim/mbyte.h1
-rw-r--r--src/nvim/message.c1
-rw-r--r--src/nvim/message.h52
-rw-r--r--src/nvim/tui/tui.h2
-rw-r--r--src/nvim/ugrid.h2
-rw-r--r--src/nvim/ui_client.h2
-rw-r--r--src/nvim/ui_compositor.h1
11 files changed, 66 insertions, 67 deletions
diff --git a/src/nvim/api/ui.h b/src/nvim/api/ui.h
index 3d9152e0a4..051153de83 100644
--- a/src/nvim/api/ui.h
+++ b/src/nvim/api/ui.h
@@ -3,9 +3,9 @@
#include <stdint.h> // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: keep
-#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h" // IWYU pragma: keep
#include "nvim/map.h"
+#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h
index 00bbced55a..b93681ac14 100644
--- a/src/nvim/buffer.h
+++ b/src/nvim/buffer.h
@@ -9,63 +9,62 @@
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h"
-#include "nvim/grid_defs.h"
#include "nvim/macros.h"
#include "nvim/memline.h"
#include "nvim/memline_defs.h"
#include "nvim/pos_defs.h"
-// Values for buflist_getfile()
+/// Values for buflist_getfile()
enum getf_values {
- GETF_SETMARK = 0x01, // set pcmark before jumping
- GETF_ALT = 0x02, // jumping to alternate file (not buf num)
- GETF_SWITCH = 0x04, // respect 'switchbuf' settings when jumping
+ GETF_SETMARK = 0x01, ///< set pcmark before jumping
+ GETF_ALT = 0x02, ///< jumping to alternate file (not buf num)
+ GETF_SWITCH = 0x04, ///< respect 'switchbuf' settings when jumping
};
// Return values of getfile()
enum getf_retvalues {
- GETFILE_ERROR = 1, // normal error
- GETFILE_NOT_WRITTEN = 2, // "not written" error
- GETFILE_SAME_FILE = 0, // success, same file
- GETFILE_OPEN_OTHER = (-1), // success, opened another file
+ GETFILE_ERROR = 1, ///< normal error
+ GETFILE_NOT_WRITTEN = 2, ///< "not written" error
+ GETFILE_SAME_FILE = 0, ///< success, same file
+ GETFILE_OPEN_OTHER = -1, ///< success, opened another file
GETFILE_UNUSED = 8,
};
-// Values for buflist_new() flags
+/// Values for buflist_new() flags
enum bln_values {
- BLN_CURBUF = 1, // May re-use curbuf for new buffer
- BLN_LISTED = 2, // Put new buffer in buffer list
- BLN_DUMMY = 4, // Allocating dummy buffer
- BLN_NEW = 8, // create a new buffer
- BLN_NOOPT = 16, // Don't copy options to existing buffer
+ BLN_CURBUF = 1, ///< May re-use curbuf for new buffer
+ BLN_LISTED = 2, ///< Put new buffer in buffer list
+ BLN_DUMMY = 4, ///< Allocating dummy buffer
+ BLN_NEW = 8, ///< create a new buffer
+ BLN_NOOPT = 16, ///< Don't copy options to existing buffer
// BLN_DUMMY_OK = 32, // also find an existing dummy buffer
// BLN_REUSE = 64, // may re-use number from buf_reuse
- BLN_NOCURWIN = 128, // buffer is not associated with curwin
+ BLN_NOCURWIN = 128, ///< buffer is not associated with curwin
};
-// Values for action argument for do_buffer()
+/// Values for action argument for do_buffer()
enum dobuf_action_values {
- DOBUF_GOTO = 0, // go to specified buffer
- DOBUF_SPLIT = 1, // split window and go to specified buffer
- DOBUF_UNLOAD = 2, // unload specified buffer(s)
- DOBUF_DEL = 3, // delete specified buffer(s) from buflist
- DOBUF_WIPE = 4, // delete specified buffer(s) really
+ DOBUF_GOTO = 0, ///< go to specified buffer
+ DOBUF_SPLIT = 1, ///< split window and go to specified buffer
+ DOBUF_UNLOAD = 2, ///< unload specified buffer(s)
+ DOBUF_DEL = 3, ///< delete specified buffer(s) from buflist
+ DOBUF_WIPE = 4, ///< delete specified buffer(s) really
};
-// Values for start argument for do_buffer()
+/// Values for start argument for do_buffer()
enum dobuf_start_values {
- DOBUF_CURRENT = 0, // "count" buffer from current buffer
- DOBUF_FIRST = 1, // "count" buffer from first buffer
- DOBUF_LAST = 2, // "count" buffer from last buffer
- DOBUF_MOD = 3, // "count" mod. buffer from current buffer
+ DOBUF_CURRENT = 0, ///< "count" buffer from current buffer
+ DOBUF_FIRST = 1, ///< "count" buffer from first buffer
+ DOBUF_LAST = 2, ///< "count" buffer from last buffer
+ DOBUF_MOD = 3, ///< "count" mod. buffer from current buffer
};
-// flags for buf_freeall()
+/// flags for buf_freeall()
enum bfa_values {
- BFA_DEL = 1, // buffer is going to be deleted
- BFA_WIPE = 2, // buffer is going to be wiped out
- BFA_KEEP_UNDO = 4, // do not free undo information
- BFA_IGNORE_ABORT = 8, // do not abort for aborting()
+ BFA_DEL = 1, ///< buffer is going to be deleted
+ BFA_WIPE = 2, ///< buffer is going to be wiped out
+ BFA_KEEP_UNDO = 4, ///< do not free undo information
+ BFA_IGNORE_ABORT = 8, ///< do not abort for aborting()
};
EXTERN char *msg_loclist INIT( = N_("[Location List]"));
@@ -136,6 +135,5 @@ static inline void buf_inc_changedtick(buf_T *const buf)
static inline bool buf_is_empty(buf_T *buf)
{
- return buf->b_ml.ml_line_count == 1
- && *ml_get_buf(buf, 1) == '\0';
+ return buf->b_ml.ml_line_count == 1 && *ml_get_buf(buf, 1) == '\0';
}
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index 3a8a9c74bb..29993bffa5 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -2,12 +2,10 @@
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
-#include <string.h>
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
-#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/decoration.h"
#include "nvim/drawscreen.h"
@@ -16,7 +14,6 @@
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
-#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/move.h"
#include "nvim/option_vars.h"
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index c50331e7d5..9443511640 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -49,7 +49,6 @@
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/grid.h"
-#include "nvim/grid_defs.h"
#include "nvim/iconv.h"
#include "nvim/keycodes.h"
#include "nvim/macros.h"
diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h
index 5623d0c106..6e27679198 100644
--- a/src/nvim/mbyte.h
+++ b/src/nvim/mbyte.h
@@ -7,7 +7,6 @@
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/func_attr.h"
-#include "nvim/grid_defs.h"
#include "nvim/mbyte_defs.h" // IWYU pragma: export
#include "nvim/os/os_defs.h"
#include "nvim/types_defs.h" // IWYU pragma: keep
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 06badf85a1..fcfaf636e6 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -51,6 +51,7 @@
#include "nvim/regexp.h"
#include "nvim/runtime.h"
#include "nvim/strings.h"
+#include "nvim/types_defs.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/vim.h"
diff --git a/src/nvim/message.h b/src/nvim/message.h
index 2f7f67937d..1e6e1dec70 100644
--- a/src/nvim/message.h
+++ b/src/nvim/message.h
@@ -11,20 +11,24 @@
#include "nvim/macros.h"
#include "nvim/types_defs.h"
-// Types of dialogs passed to do_dialog().
-#define VIM_GENERIC 0
-#define VIM_ERROR 1
-#define VIM_WARNING 2
-#define VIM_INFO 3
-#define VIM_QUESTION 4
-#define VIM_LAST_TYPE 4 // sentinel value
+/// Types of dialogs passed to do_dialog().
+enum {
+ VIM_GENERIC = 0,
+ VIM_ERROR = 1,
+ VIM_WARNING = 2,
+ VIM_INFO = 3,
+ VIM_QUESTION = 4,
+ VIM_LAST_TYPE = 4, ///< sentinel value
+};
-// Return values for functions like vim_dialogyesno()
-#define VIM_YES 2
-#define VIM_NO 3
-#define VIM_CANCEL 4
-#define VIM_ALL 5
-#define VIM_DISCARDALL 6
+/// Return values for functions like vim_dialogyesno()
+enum {
+ VIM_YES = 2,
+ VIM_NO = 3,
+ VIM_CANCEL = 4,
+ VIM_ALL = 5,
+ VIM_DISCARDALL = 6,
+};
typedef struct {
String text;
@@ -36,8 +40,8 @@ typedef kvec_t(HlMessageChunk) HlMessage;
/// Message history for `:messages`
typedef struct msg_hist {
struct msg_hist *next; ///< Next message.
- char *msg; ///< Message text.
- const char *kind; ///< Message kind (for msg_ext)
+ char *msg; ///< Message text.
+ const char *kind; ///< Message kind (for msg_ext)
int attr; ///< Message highlighting.
bool multiline; ///< Multiline message.
HlMessage multiattr; ///< multiattr message.
@@ -50,20 +54,20 @@ extern MessageHistoryEntry *last_msg_hist;
EXTERN bool msg_ext_need_clear INIT( = false);
-// allocated grid for messages. Used when display+=msgsep is set, or
-// ext_multigrid is active. See also the description at msg_scroll_flush()
+/// allocated grid for messages. Used when display+=msgsep is set, or
+/// ext_multigrid is active. See also the description at msg_scroll_flush()
EXTERN ScreenGrid msg_grid INIT( = SCREEN_GRID_INIT);
EXTERN int msg_grid_pos INIT( = 0);
-// "adjusted" message grid. This grid accepts positions relative to
-// default_grid. Internally it will be translated to a position on msg_grid
-// relative to the start of the message area, or directly mapped to default_grid
-// for legacy (display-=msgsep) message scroll behavior.
-// // TODO(bfredl): refactor "internal" message logic, msg_row etc
-// to use the correct positions already.
+/// "adjusted" message grid. This grid accepts positions relative to
+/// default_grid. Internally it will be translated to a position on msg_grid
+/// relative to the start of the message area, or directly mapped to default_grid
+/// for legacy (display-=msgsep) message scroll behavior.
+/// TODO(bfredl): refactor "internal" message logic, msg_row etc
+/// to use the correct positions already.
EXTERN ScreenGrid msg_grid_adj INIT( = SCREEN_GRID_INIT);
-// value of msg_scrolled at latest msg_scroll_flush.
+/// value of msg_scrolled at latest msg_scroll_flush.
EXTERN int msg_scrolled_at_flush INIT( = 0);
EXTERN int msg_grid_scroll_discount INIT( = 0);
diff --git a/src/nvim/tui/tui.h b/src/nvim/tui/tui.h
index 76a5ef9a6b..8eb4ac9bd8 100644
--- a/src/nvim/tui/tui.h
+++ b/src/nvim/tui/tui.h
@@ -1,8 +1,8 @@
#pragma once
#include "nvim/api/private/defs.h" // IWYU pragma: keep
-#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h" // IWYU pragma: keep
+#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
typedef struct TUIData TUIData;
diff --git a/src/nvim/ugrid.h b/src/nvim/ugrid.h
index a82b0e1c9d..54cd33e58f 100644
--- a/src/nvim/ugrid.h
+++ b/src/nvim/ugrid.h
@@ -1,6 +1,6 @@
#pragma once
-#include "nvim/grid_defs.h"
+#include "nvim/types_defs.h"
typedef struct ucell {
schar_T data;
diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h
index 383f69c5f7..48dd9a0835 100644
--- a/src/nvim/ui_client.h
+++ b/src/nvim/ui_client.h
@@ -5,7 +5,7 @@
#include <stdint.h>
#include "nvim/api/private/defs.h"
-#include "nvim/grid_defs.h"
+#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/macros.h"
#include "nvim/types_defs.h"
diff --git a/src/nvim/ui_compositor.h b/src/nvim/ui_compositor.h
index 951160deaf..f3f5981680 100644
--- a/src/nvim/ui_compositor.h
+++ b/src/nvim/ui_compositor.h
@@ -3,6 +3,7 @@
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/event/defs.h"
#include "nvim/grid_defs.h" // IWYU pragma: keep
+#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS