mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
refactor(IWYU): create normal_defs.h (#26293)
This commit is contained in:
parent
8868ecd401
commit
64b53b71ba
1
Makefile
1
Makefile
@ -224,7 +224,6 @@ iwyu: build/.ran-cmake
|
|||||||
|src/nvim/search.h\
|
|src/nvim/search.h\
|
||||||
|src/nvim/spell.h\
|
|src/nvim/spell.h\
|
||||||
|src/nvim/syntax.h\
|
|src/nvim/syntax.h\
|
||||||
|src/nvim/textformat.h\
|
|
||||||
|src/nvim/textobject.h\
|
|src/nvim/textobject.h\
|
||||||
|src/nvim/tui/input.h\
|
|src/nvim/tui/input.h\
|
||||||
|src/nvim/tui/tui.h\
|
|src/nvim/tui/tui.h\
|
||||||
|
@ -979,7 +979,6 @@ def CheckIncludes(filename, lines, error):
|
|||||||
"src/nvim/search.h",
|
"src/nvim/search.h",
|
||||||
"src/nvim/spell.h",
|
"src/nvim/spell.h",
|
||||||
"src/nvim/syntax.h",
|
"src/nvim/syntax.h",
|
||||||
"src/nvim/textformat.h",
|
|
||||||
"src/nvim/textobject.h",
|
"src/nvim/textobject.h",
|
||||||
"src/nvim/tui/input.h",
|
"src/nvim/tui/input.h",
|
||||||
"src/nvim/tui/tui.h",
|
"src/nvim/tui/tui.h",
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/optionstr.h"
|
#include "nvim/optionstr.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/os/process.h"
|
#include "nvim/os/process.h"
|
||||||
#include "nvim/popupmenu.h"
|
#include "nvim/popupmenu.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
#include "nvim/os/os.h"
|
|
||||||
#include "nvim/path.h"
|
#include "nvim/path.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/sha256.h"
|
#include "nvim/sha256.h"
|
||||||
|
@ -92,7 +92,6 @@
|
|||||||
#include "nvim/normal.h"
|
#include "nvim/normal.h"
|
||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/plines.h"
|
#include "nvim/plines.h"
|
||||||
#include "nvim/popupmenu.h"
|
#include "nvim/popupmenu.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "nvim/eval/typval_defs.h"
|
#include "nvim/eval/typval_defs.h"
|
||||||
#include "nvim/ex_eval_defs.h"
|
#include "nvim/ex_eval_defs.h"
|
||||||
#include "nvim/normal.h"
|
#include "nvim/normal_defs.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/regexp_defs.h"
|
#include "nvim/regexp_defs.h"
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "nvim/buffer_defs.h" // IWYU pragma: keep
|
||||||
|
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/buffer_defs.h"
|
#include "nvim/normal_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/normal.h"
|
#include "nvim/types_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/vim_defs.h"
|
||||||
#include "nvim/window.h"
|
|
||||||
|
|
||||||
/// jump_to_mouse() returns one of first five these values, possibly with
|
/// jump_to_mouse() returns one of first five these values, possibly with
|
||||||
/// some of the other five added.
|
/// some of the other five added.
|
||||||
|
@ -1,81 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "nvim/buffer_defs.h" // IWYU pragma: keep
|
#include "nvim/buffer_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/macros_defs.h"
|
#include "nvim/macros_defs.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/normal_defs.h" // IWYU pragma: export
|
||||||
|
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
// Values for find_ident_under_cursor()
|
/// Values for find_ident_under_cursor()
|
||||||
#define FIND_IDENT 1 // find identifier (word)
|
enum {
|
||||||
#define FIND_STRING 2 // find any string (WORD)
|
FIND_IDENT = 1, ///< find identifier (word)
|
||||||
#define FIND_EVAL 4 // include "->", "[]" and "."
|
FIND_STRING = 2, ///< find any string (WORD)
|
||||||
|
FIND_EVAL = 4, ///< include "->", "[]" and "."
|
||||||
|
};
|
||||||
|
|
||||||
/// Motion types, used for operators and for yank/delete registers.
|
/// 'showcmd' buffer shared between normal.c and statusline.c
|
||||||
///
|
|
||||||
/// The three valid numerical values must not be changed, as they
|
|
||||||
/// are used in external communication and serialization.
|
|
||||||
typedef enum {
|
|
||||||
kMTCharWise = 0, ///< character-wise movement/register
|
|
||||||
kMTLineWise = 1, ///< line-wise movement/register
|
|
||||||
kMTBlockWise = 2, ///< block-wise movement/register
|
|
||||||
kMTUnknown = -1, ///< Unknown or invalid motion type
|
|
||||||
} MotionType;
|
|
||||||
|
|
||||||
// Arguments for operators.
|
|
||||||
typedef struct oparg_S {
|
|
||||||
int op_type; // current pending operator type
|
|
||||||
int regname; // register to use for the operator
|
|
||||||
MotionType motion_type; // type of the current cursor motion
|
|
||||||
int motion_force; // force motion type: 'v', 'V' or CTRL-V
|
|
||||||
bool use_reg_one; // true if delete uses reg 1 even when not
|
|
||||||
// linewise
|
|
||||||
bool inclusive; // true if char motion is inclusive (only
|
|
||||||
// valid when motion_type is kMTCharWise)
|
|
||||||
bool end_adjusted; // backuped b_op_end one char (only used by
|
|
||||||
// do_format())
|
|
||||||
pos_T start; // start of the operator
|
|
||||||
pos_T end; // end of the operator
|
|
||||||
pos_T cursor_start; // cursor position before motion for "gw"
|
|
||||||
|
|
||||||
linenr_T line_count; // number of lines from op_start to op_end
|
|
||||||
// (inclusive)
|
|
||||||
bool empty; // op_start and op_end the same (only used by
|
|
||||||
// op_change())
|
|
||||||
bool is_VIsual; // operator on Visual area
|
|
||||||
colnr_T start_vcol; // start col for block mode operator
|
|
||||||
colnr_T end_vcol; // end col for block mode operator
|
|
||||||
int prev_opcount; // ca.opcount saved for K_EVENT
|
|
||||||
int prev_count0; // ca.count0 saved for K_EVENT
|
|
||||||
bool excl_tr_ws; // exclude trailing whitespace for yank of a
|
|
||||||
// block
|
|
||||||
} oparg_T;
|
|
||||||
|
|
||||||
// Arguments for Normal mode commands.
|
|
||||||
typedef struct cmdarg_S {
|
|
||||||
oparg_T *oap; // Operator arguments
|
|
||||||
int prechar; // prefix character (optional, always 'g')
|
|
||||||
int cmdchar; // command character
|
|
||||||
int nchar; // next command character (optional)
|
|
||||||
int ncharC1; // first composing character (optional)
|
|
||||||
int ncharC2; // second composing character (optional)
|
|
||||||
int extra_char; // yet another character (optional)
|
|
||||||
int opcount; // count before an operator
|
|
||||||
int count0; // count before command, default 0
|
|
||||||
int count1; // count before command, default 1
|
|
||||||
int arg; // extra argument from nv_cmds[]
|
|
||||||
int retval; // return: CA_* values
|
|
||||||
char *searchbuf; // return: pointer to search pattern or NULL
|
|
||||||
} cmdarg_T;
|
|
||||||
|
|
||||||
// values for retval:
|
|
||||||
#define CA_COMMAND_BUSY 1 // skip restarting edit() once
|
|
||||||
#define CA_NO_ADJ_OP_END 2 // don't adjust operator end
|
|
||||||
|
|
||||||
// columns needed by shown command
|
|
||||||
#define SHOWCMD_COLS 10
|
|
||||||
// 'showcmd' buffer shared between normal.c and statusline.c
|
|
||||||
#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30)
|
|
||||||
EXTERN char showcmd_buf[SHOWCMD_BUFLEN];
|
EXTERN char showcmd_buf[SHOWCMD_BUFLEN];
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
|
69
src/nvim/normal_defs.h
Normal file
69
src/nvim/normal_defs.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "nvim/pos_defs.h"
|
||||||
|
|
||||||
|
/// Motion types, used for operators and for yank/delete registers.
|
||||||
|
///
|
||||||
|
/// The three valid numerical values must not be changed, as they
|
||||||
|
/// are used in external communication and serialization.
|
||||||
|
typedef enum {
|
||||||
|
kMTCharWise = 0, ///< character-wise movement/register
|
||||||
|
kMTLineWise = 1, ///< line-wise movement/register
|
||||||
|
kMTBlockWise = 2, ///< block-wise movement/register
|
||||||
|
kMTUnknown = -1, ///< Unknown or invalid motion type
|
||||||
|
} MotionType;
|
||||||
|
|
||||||
|
/// Arguments for operators.
|
||||||
|
typedef struct oparg_S {
|
||||||
|
int op_type; ///< current pending operator type
|
||||||
|
int regname; ///< register to use for the operator
|
||||||
|
MotionType motion_type; ///< type of the current cursor motion
|
||||||
|
int motion_force; ///< force motion type: 'v', 'V' or CTRL-V
|
||||||
|
bool use_reg_one; ///< true if delete uses reg 1 even when not
|
||||||
|
///< linewise
|
||||||
|
bool inclusive; ///< true if char motion is inclusive (only
|
||||||
|
///< valid when motion_type is kMTCharWise)
|
||||||
|
bool end_adjusted; ///< backuped b_op_end one char (only used by
|
||||||
|
///< do_format())
|
||||||
|
pos_T start; ///< start of the operator
|
||||||
|
pos_T end; ///< end of the operator
|
||||||
|
pos_T cursor_start; ///< cursor position before motion for "gw"
|
||||||
|
|
||||||
|
linenr_T line_count; ///< number of lines from op_start to op_end (inclusive)
|
||||||
|
bool empty; ///< op_start and op_end the same (only used by op_change())
|
||||||
|
bool is_VIsual; ///< operator on Visual area
|
||||||
|
colnr_T start_vcol; ///< start col for block mode operator
|
||||||
|
colnr_T end_vcol; ///< end col for block mode operator
|
||||||
|
int prev_opcount; ///< ca.opcount saved for K_EVENT
|
||||||
|
int prev_count0; ///< ca.count0 saved for K_EVENT
|
||||||
|
bool excl_tr_ws; ///< exclude trailing whitespace for yank of a block
|
||||||
|
} oparg_T;
|
||||||
|
|
||||||
|
/// Arguments for Normal mode commands.
|
||||||
|
typedef struct cmdarg_S {
|
||||||
|
oparg_T *oap; ///< Operator arguments
|
||||||
|
int prechar; ///< prefix character (optional, always 'g')
|
||||||
|
int cmdchar; ///< command character
|
||||||
|
int nchar; ///< next command character (optional)
|
||||||
|
int ncharC1; ///< first composing character (optional)
|
||||||
|
int ncharC2; ///< second composing character (optional)
|
||||||
|
int extra_char; ///< yet another character (optional)
|
||||||
|
int opcount; ///< count before an operator
|
||||||
|
int count0; ///< count before command, default 0
|
||||||
|
int count1; ///< count before command, default 1
|
||||||
|
int arg; ///< extra argument from nv_cmds[]
|
||||||
|
int retval; ///< return: CA_* values
|
||||||
|
char *searchbuf; ///< return: pointer to search pattern or NULL
|
||||||
|
} cmdarg_T;
|
||||||
|
|
||||||
|
/// values for retval:
|
||||||
|
enum {
|
||||||
|
CA_COMMAND_BUSY = 1, ///< skip restarting edit() once
|
||||||
|
CA_NO_ADJ_OP_END = 2, ///< don't adjust operator end
|
||||||
|
};
|
||||||
|
|
||||||
|
/// columns needed by shown command
|
||||||
|
enum { SHOWCMD_COLS = 10, };
|
||||||
|
enum { SHOWCMD_BUFLEN = SHOWCMD_COLS + 1 + 30, };
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h> // IWYU pragma: keep
|
||||||
|
|
||||||
#include "nvim/api/private/defs.h" // IWYU pragma: keep
|
#include "nvim/api/private/defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/api/private/helpers.h"
|
#include "nvim/api/private/helpers.h"
|
||||||
@ -8,7 +9,6 @@
|
|||||||
#include "nvim/eval/typval_defs.h"
|
#include "nvim/eval/typval_defs.h"
|
||||||
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/option_defs.h" // IWYU pragma: export
|
#include "nvim/option_defs.h" // IWYU pragma: export
|
||||||
#include "nvim/search.h"
|
|
||||||
#include "nvim/types_defs.h" // IWYU pragma: keep
|
#include "nvim/types_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
/// The options that are local to a window or buffer have "indir" set to one of
|
/// The options that are local to a window or buffer have "indir" set to one of
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/os/shell.h"
|
#include "nvim/os/shell.h"
|
||||||
#include "nvim/os/signal.h"
|
#include "nvim/os/signal.h"
|
||||||
#include "nvim/os/time.h"
|
#include "nvim/os/time.h"
|
||||||
|
@ -5,9 +5,10 @@
|
|||||||
|
|
||||||
#include "nvim/buffer_defs.h"
|
#include "nvim/buffer_defs.h"
|
||||||
#include "nvim/eval/typval_defs.h"
|
#include "nvim/eval/typval_defs.h"
|
||||||
#include "nvim/normal.h"
|
#include "nvim/normal_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/os/time.h"
|
#include "nvim/os/time_defs.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
#include "nvim/regexp_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/types_defs.h"
|
#include "nvim/types_defs.h"
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/vim_defs.h"
|
||||||
|
|
||||||
|
@ -91,7 +91,6 @@
|
|||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/path.h"
|
#include "nvim/path.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/regexp.h"
|
#include "nvim/regexp.h"
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/profile.h"
|
#include "nvim/profile.h"
|
||||||
#include "nvim/spell.h"
|
#include "nvim/spell.h"
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "nvim/optionstr.h"
|
#include "nvim/optionstr.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/os/time.h"
|
#include "nvim/os/time.h"
|
||||||
#include "nvim/path.h"
|
#include "nvim/path.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/move.h"
|
#include "nvim/move.h"
|
||||||
#include "nvim/normal.h"
|
|
||||||
#include "nvim/ops.h"
|
#include "nvim/ops.h"
|
||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nvim/normal.h"
|
#include "nvim/normal_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "nvim/memline.h"
|
#include "nvim/memline.h"
|
||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/move.h"
|
#include "nvim/move.h"
|
||||||
#include "nvim/normal.h"
|
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/search.h"
|
#include "nvim/search.h"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nvim/normal.h"
|
#include "nvim/normal_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/vim_defs.h"
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
#include "nvim/option_defs.h"
|
#include "nvim/option_defs.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/fs.h"
|
#include "nvim/os/fs.h"
|
||||||
#include "nvim/os/os_defs.h"
|
|
||||||
#include "nvim/path.h"
|
#include "nvim/path.h"
|
||||||
#include "nvim/plines.h"
|
#include "nvim/plines.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user