mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 02:34:59 -07:00
refactor: move some constants out of vim_defs.h (#26298)
This commit is contained in:
parent
f4001d27ef
commit
a6cba103ce
9
Makefile
9
Makefile
@ -143,7 +143,6 @@ iwyu: build/.ran-cmake
|
||||
cmake --build build > build/iwyu.log
|
||||
iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c|src/nvim/auto/|src/nvim/os/lang.c|src/nvim/map.c\
|
||||
|src/nvim/api/extmark.h\
|
||||
|src/nvim/api/private/defs.h\
|
||||
|src/nvim/api/private/dispatch.h\
|
||||
|src/nvim/api/private/helpers.h\
|
||||
|src/nvim/api/private/validate.h\
|
||||
@ -154,14 +153,11 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/autocmd_defs.h\
|
||||
|src/nvim/buffer.h\
|
||||
|src/nvim/buffer_defs.h\
|
||||
|src/nvim/buffer_updates.h\
|
||||
|src/nvim/channel.h\
|
||||
|src/nvim/charset.h\
|
||||
|src/nvim/cmdexpand.h\
|
||||
|src/nvim/cmdhist.h\
|
||||
|src/nvim/context.h\
|
||||
|src/nvim/decoration.h\
|
||||
|src/nvim/decoration_provider.h\
|
||||
|src/nvim/diff.h\
|
||||
|src/nvim/drawline.h\
|
||||
|src/nvim/drawscreen.h\
|
||||
@ -169,7 +165,6 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/eval/encode.h\
|
||||
|src/nvim/eval/typval.h\
|
||||
|src/nvim/eval/typval_defs.h\
|
||||
|src/nvim/eval/typval_encode.h\
|
||||
|src/nvim/eval/userfunc.h\
|
||||
|src/nvim/eval/window.h\
|
||||
|src/nvim/event/libuv_process.h\
|
||||
@ -185,7 +180,6 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/ex_cmds.h\
|
||||
|src/nvim/ex_cmds_defs.h\
|
||||
|src/nvim/ex_docmd.h\
|
||||
|src/nvim/ex_getln.h\
|
||||
|src/nvim/extmark.h\
|
||||
|src/nvim/file_search.h\
|
||||
|src/nvim/fileio.h\
|
||||
@ -203,15 +197,12 @@ iwyu: build/.ran-cmake
|
||||
|src/nvim/lua/executor.h\
|
||||
|src/nvim/main.h\
|
||||
|src/nvim/mark.h\
|
||||
|src/nvim/marktree.h\
|
||||
|src/nvim/message.h\
|
||||
|src/nvim/mouse.h\
|
||||
|src/nvim/move.h\
|
||||
|src/nvim/msgpack_rpc/channel.h\
|
||||
|src/nvim/msgpack_rpc/channel_defs.h\
|
||||
|src/nvim/msgpack_rpc/helpers.h\
|
||||
|src/nvim/msgpack_rpc/unpacker.h\
|
||||
|src/nvim/ops.h\
|
||||
|src/nvim/option.h\
|
||||
|src/nvim/os/fileio.h\
|
||||
|src/nvim/os/input.h\
|
||||
|
8
runtime/doc/builtin.txt
generated
8
runtime/doc/builtin.txt
generated
@ -4189,8 +4189,8 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
||||
"mode_bits" Nvim's internal binary representation of "mode".
|
||||
|mapset()| ignores this; only "mode" is used.
|
||||
See |maplist()| for usage examples. The values
|
||||
are from src/nvim/vim.h and may change in the
|
||||
future.
|
||||
are from src/nvim/state_defs.h and may change in
|
||||
the future.
|
||||
|
||||
The dictionary can be used to restore a mapping with
|
||||
|mapset()|.
|
||||
@ -4257,8 +4257,8 @@ maplist([{abbr}]) *maplist()*
|
||||
endfor
|
||||
echo saved_maps->mapnew({_, m -> m.lhs})
|
||||
< The values of the mode_bits are defined in Nvim's
|
||||
src/nvim/vim.h file and they can be discovered at runtime
|
||||
using |:map-commands| and "maplist()". Example: >vim
|
||||
src/nvim/state_defs.h file and they can be discovered at
|
||||
runtime using |:map-commands| and "maplist()". Example: >vim
|
||||
omap xyzzy <Nop>
|
||||
let op_bit = maplist()->filter(
|
||||
\ {_, m -> m.lhs == 'xyzzy'})[0].mode_bits
|
||||
|
8
runtime/lua/vim/_meta/vimfn.lua
generated
8
runtime/lua/vim/_meta/vimfn.lua
generated
@ -5050,8 +5050,8 @@ function vim.fn.map(expr1, expr2) end
|
||||
--- "mode_bits" Nvim's internal binary representation of "mode".
|
||||
--- |mapset()| ignores this; only "mode" is used.
|
||||
--- See |maplist()| for usage examples. The values
|
||||
--- are from src/nvim/vim.h and may change in the
|
||||
--- future.
|
||||
--- are from src/nvim/state_defs.h and may change in
|
||||
--- the future.
|
||||
---
|
||||
--- The dictionary can be used to restore a mapping with
|
||||
--- |mapset()|.
|
||||
@ -5129,8 +5129,8 @@ function vim.fn.mapcheck(name, mode, abbr) end
|
||||
--- endfor
|
||||
--- echo saved_maps->mapnew({_, m -> m.lhs})
|
||||
--- <The values of the mode_bits are defined in Nvim's
|
||||
--- src/nvim/vim.h file and they can be discovered at runtime
|
||||
--- using |:map-commands| and "maplist()". Example: >vim
|
||||
--- src/nvim/state_defs.h file and they can be discovered at
|
||||
--- runtime using |:map-commands| and "maplist()". Example: >vim
|
||||
--- omap xyzzy <Nop>
|
||||
--- let op_bit = maplist()->filter(
|
||||
--- \ {_, m -> m.lhs == 'xyzzy'})[0].mode_bits
|
||||
|
@ -898,7 +898,6 @@ def CheckIncludes(filename, lines, error):
|
||||
# the Makefile.
|
||||
check_includes_ignore = [
|
||||
"src/nvim/api/extmark.h",
|
||||
"src/nvim/api/private/defs.h",
|
||||
"src/nvim/api/private/dispatch.h",
|
||||
"src/nvim/api/private/helpers.h",
|
||||
"src/nvim/api/private/validate.h",
|
||||
@ -909,14 +908,11 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/autocmd_defs.h",
|
||||
"src/nvim/buffer.h",
|
||||
"src/nvim/buffer_defs.h",
|
||||
"src/nvim/buffer_updates.h",
|
||||
"src/nvim/channel.h",
|
||||
"src/nvim/charset.h",
|
||||
"src/nvim/cmdexpand.h",
|
||||
"src/nvim/cmdhist.h",
|
||||
"src/nvim/context.h",
|
||||
"src/nvim/decoration.h",
|
||||
"src/nvim/decoration_provider.h",
|
||||
"src/nvim/diff.h",
|
||||
"src/nvim/drawline.h",
|
||||
"src/nvim/drawscreen.h",
|
||||
@ -924,7 +920,6 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/eval/encode.h",
|
||||
"src/nvim/eval/typval.h",
|
||||
"src/nvim/eval/typval_defs.h",
|
||||
"src/nvim/eval/typval_encode.h",
|
||||
"src/nvim/eval/userfunc.h",
|
||||
"src/nvim/eval/window.h",
|
||||
"src/nvim/event/libuv_process.h",
|
||||
@ -940,7 +935,6 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/ex_cmds.h",
|
||||
"src/nvim/ex_cmds_defs.h",
|
||||
"src/nvim/ex_docmd.h",
|
||||
"src/nvim/ex_getln.h",
|
||||
"src/nvim/extmark.h",
|
||||
"src/nvim/file_search.h",
|
||||
"src/nvim/fileio.h",
|
||||
@ -958,15 +952,12 @@ def CheckIncludes(filename, lines, error):
|
||||
"src/nvim/lua/executor.h",
|
||||
"src/nvim/main.h",
|
||||
"src/nvim/mark.h",
|
||||
"src/nvim/marktree.h",
|
||||
"src/nvim/message.h",
|
||||
"src/nvim/mouse.h",
|
||||
"src/nvim/move.h",
|
||||
"src/nvim/msgpack_rpc/channel.h",
|
||||
"src/nvim/msgpack_rpc/channel_defs.h",
|
||||
"src/nvim/msgpack_rpc/helpers.h",
|
||||
"src/nvim/msgpack_rpc/unpacker.h",
|
||||
"src/nvim/ops.h",
|
||||
"src/nvim/option.h",
|
||||
"src/nvim/os/fileio.h",
|
||||
"src/nvim/os/input.h",
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "nvim/move.h"
|
||||
#include "nvim/ops.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/undo.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/insexpand.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/main.h"
|
||||
|
@ -89,8 +89,8 @@
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/sign.h"
|
||||
#include "nvim/spell.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/statusline.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/syntax.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/log.h"
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <stdint.h> // IWYU pragma: keep
|
||||
|
||||
#include "nvim/buffer_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/extmark_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "buffer_updates.h.generated.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/iconv_defs.h"
|
||||
#include "nvim/input.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/insexpand.h"
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/help.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/log.h"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <msgpack.h>
|
||||
#include <msgpack/sbuffer.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
/// batch mode debugging: don't save and restore typeahead.
|
||||
|
@ -1,16 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stddef.h> // IWYU pragma: keep
|
||||
#include <stdint.h>
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/decoration_defs.h" // IWYU pragma: export
|
||||
#include "nvim/extmark_defs.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/marktree.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
// actual Decor* data is in decoration_defs.h
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/buffer_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/mapping.h"
|
||||
#include "nvim/mbyte.h"
|
||||
@ -32,6 +32,7 @@
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/fold_defs.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/highlight.h"
|
||||
@ -48,8 +49,7 @@
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#define MB_FILLER_CHAR '<' // character used when a double-width character
|
||||
// doesn't fit.
|
||||
#define MB_FILLER_CHAR '<' // character used when a double-width character doesn't fit.
|
||||
|
||||
/// possible draw states in win_line(), drawn in sequence.
|
||||
typedef enum {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/decoration_provider.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/fold_defs.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/indent_c.h"
|
||||
|
@ -277,6 +277,9 @@ enum {
|
||||
EVAL_EVALUATE = 1, ///< when missing don't actually evaluate
|
||||
};
|
||||
|
||||
// Character used as separated in autoload function/variable names.
|
||||
#define AUTOLOAD_CHAR '#'
|
||||
|
||||
/// Passed to an eval() function to enable evaluation.
|
||||
EXTERN evalarg_T EVALARG_EVALUATE INIT( = { EVAL_EVALUATE, NULL, NULL, NULL });
|
||||
|
||||
|
@ -6198,8 +6198,8 @@ M.funcs = {
|
||||
"mode_bits" Nvim's internal binary representation of "mode".
|
||||
|mapset()| ignores this; only "mode" is used.
|
||||
See |maplist()| for usage examples. The values
|
||||
are from src/nvim/vim.h and may change in the
|
||||
future.
|
||||
are from src/nvim/state_defs.h and may change in
|
||||
the future.
|
||||
|
||||
The dictionary can be used to restore a mapping with
|
||||
|mapset()|.
|
||||
@ -6287,8 +6287,8 @@ M.funcs = {
|
||||
endfor
|
||||
echo saved_maps->mapnew({_, m -> m.lhs})
|
||||
<The values of the mode_bits are defined in Nvim's
|
||||
src/nvim/vim.h file and they can be discovered at runtime
|
||||
using |:map-commands| and "maplist()". Example: >vim
|
||||
src/nvim/state_defs.h file and they can be discovered at
|
||||
runtime using |:map-commands| and "maplist()". Example: >vim
|
||||
omap xyzzy <Nop>
|
||||
let op_bit = maplist()->filter(
|
||||
\ {_, m -> m.lhs == 'xyzzy'})[0].mode_bits
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/help.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/input.h"
|
||||
@ -79,6 +79,7 @@
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/spell.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/terminal.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/memory.h"
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/input.h"
|
||||
#include "nvim/keycodes.h"
|
||||
|
@ -28,6 +28,8 @@ enum {
|
||||
// Whether a command index indicates a user command.
|
||||
#define IS_USER_CMDIDX(idx) ((int)(idx) < 0)
|
||||
|
||||
enum { DIALOG_MSG_SIZE = 1000, }; ///< buffer size for dialog_msg()
|
||||
|
||||
/// Structure used to save the current state. Used when executing Normal mode
|
||||
/// commands while in any other mode.
|
||||
typedef struct {
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include "nvim/option_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/types_defs.h" // IWYU pragma: keep
|
||||
|
||||
struct cmdline_info;
|
||||
|
||||
/// Command-line colors: one chunk
|
||||
///
|
||||
/// Defines a region which has the same highlighting.
|
||||
|
@ -26,6 +26,7 @@
|
||||
// code for redrawing the line with the deleted decoration.
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
|
@ -17,9 +17,6 @@ EXTERN int extmark_splice_pending INIT( = 0);
|
||||
|
||||
typedef kvec_t(MTPair) ExtmarkInfoArray;
|
||||
|
||||
// TODO(bfredl): good enough name for now.
|
||||
typedef ptrdiff_t bcount_t;
|
||||
|
||||
// delete the columns between mincol and endcol
|
||||
typedef struct {
|
||||
int start_row;
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
// TODO(bfredl): good enough name for now.
|
||||
typedef ptrdiff_t bcount_t;
|
||||
|
||||
typedef struct undo_object ExtmarkUndoObject;
|
||||
typedef kvec_t(ExtmarkUndoObject) extmark_undo_vec_t;
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/iconv_defs.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
@ -60,6 +60,7 @@
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/sha256.h"
|
||||
#include "nvim/shada.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nvim/plines.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/syntax.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
@ -2,13 +2,14 @@
|
||||
|
||||
#include "nvim/pos_defs.h"
|
||||
|
||||
// Info used to pass info about a fold from the fold-detection code to the
|
||||
// code that displays the foldcolumn.
|
||||
/// Info used to pass info about a fold from the fold-detection code to the
|
||||
/// code that displays the foldcolumn.
|
||||
typedef struct foldinfo {
|
||||
linenr_T fi_lnum; // line number where fold starts
|
||||
int fi_level; // level of the fold; when this is zero the
|
||||
// other fields are invalid
|
||||
int fi_low_level; // lowest fold level that starts in the same
|
||||
// line
|
||||
linenr_T fi_lnum; ///< line number where fold starts
|
||||
int fi_level; ///< level of the fold; when this is zero the
|
||||
///< other fields are invalid
|
||||
int fi_low_level; ///< lowest fold level that starts in the same line
|
||||
linenr_T fi_lines;
|
||||
} foldinfo_T;
|
||||
|
||||
enum { FOLD_TEXT_LEN = 51, }; ///< buffer size for get_foldtext()
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nvim/menu_defs.h"
|
||||
#include "nvim/os/os_defs.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/syntax_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "grid.c.generated.h"
|
||||
|
@ -29,3 +29,6 @@ static inline int win_hl_attr(win_T *wp, int hlf)
|
||||
rgb_bg = rgb_bg != -1 ? rgb_bg : (dark_ ? 0x000000 : 0xFFFFFF); \
|
||||
rgb_sp = rgb_sp != -1 ? rgb_sp : 0xFF0000; \
|
||||
} while (0);
|
||||
|
||||
// Enums need a typecast to be used as array index.
|
||||
#define HL_ATTR(n) hl_attr_active[(int)(n)]
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/textformat.h"
|
||||
#include "nvim/types_defs.h"
|
||||
@ -1369,11 +1370,11 @@ int get_lisp_indent(void)
|
||||
|
||||
static int lisp_match(char *p)
|
||||
{
|
||||
char buf[LSIZE];
|
||||
char buf[512];
|
||||
char *word = *curbuf->b_p_lw != NUL ? curbuf->b_p_lw : p_lispwords;
|
||||
|
||||
while (*word != NUL) {
|
||||
(void)copy_option_part(&word, buf, LSIZE, ",");
|
||||
(void)copy_option_part(&word, buf, sizeof(buf), ",");
|
||||
int len = (int)strlen(buf);
|
||||
|
||||
if ((strncmp(buf, p, (size_t)len) == 0) && ascii_iswhite_or_nul(p[len])) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nvim/plines.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/input.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/mbyte.h"
|
||||
@ -19,8 +19,8 @@
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/mouse.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "input.c.generated.h" // IWYU pragma: export
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/insexpand.h"
|
||||
|
@ -7,12 +7,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/memory.h"
|
||||
// FIXME: vim.h is not actually needed, but otherwise it states MAXPATHL is
|
||||
// redefined
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/eval/decode.h"
|
||||
#include "nvim/eval/typval.h"
|
||||
@ -24,6 +21,7 @@
|
||||
#include "nvim/lua/converter.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
@ -17,10 +17,6 @@
|
||||
# include <sanitizer/ubsan_interface.h>
|
||||
#endif
|
||||
|
||||
// uncrustify:off
|
||||
#include "nvim/vim_defs.h"
|
||||
// uncrustify:on
|
||||
|
||||
#include "auto/config.h" // IWYU pragma: keep
|
||||
#include "nvim/api/extmark.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
@ -99,6 +95,7 @@
|
||||
#include "nvim/ui_client.h"
|
||||
#include "nvim/ui_compositor.h"
|
||||
#include "nvim/version.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#include "nvim/window.h"
|
||||
#ifdef MSWIN
|
||||
# include "nvim/os/os_win_console.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
@ -44,6 +44,7 @@
|
||||
#include "nvim/regexp_defs.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
/// Maximum length of key sequence to be mapped.
|
||||
enum { MAXMAPLEN = 50, };
|
||||
|
||||
/// Structure used for mappings and abbreviations.
|
||||
typedef struct mapblock mapblock_T;
|
||||
struct mapblock {
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memline.h"
|
||||
|
@ -1,21 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/assert_defs.h"
|
||||
#include "nvim/decoration_defs.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/garray_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/map_defs.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/pos_defs.h" // IWYU pragma: keep
|
||||
// only for debug functions:
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
struct mtnode_s;
|
||||
#include "nvim/api/private/defs.h" // IWYU pragma: keep
|
||||
|
||||
#define MT_MAX_DEPTH 20
|
||||
#define MT_BRANCH_FACTOR 10
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
#include "nvim/iconv_defs.h"
|
||||
|
||||
/// Maximum number of bytes in a multi-byte character. It can be one 32-bit
|
||||
/// character of up to 6 bytes, or one 16-bit character of up to three bytes
|
||||
/// plus six following composing characters of three bytes each.
|
||||
enum { MB_MAXBYTES = 21, };
|
||||
|
||||
/// max length of an unicode char
|
||||
enum { MB_MAXCHAR = 6, };
|
||||
|
||||
|
@ -11,6 +11,15 @@ enum {
|
||||
MFS_ZERO = 8, ///< only write block 0
|
||||
};
|
||||
|
||||
enum {
|
||||
/// Minimal size for block 0 of a swap file.
|
||||
/// NOTE: This depends on size of struct block0! It's not done with a sizeof(),
|
||||
/// because struct block0 is defined in memline.c (Sorry).
|
||||
/// The maximal block size is arbitrary.
|
||||
MIN_SWAP_PAGE_SIZE = 1048,
|
||||
MAX_SWAP_PAGE_SIZE = 50000,
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memfile.h.generated.h"
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/input.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/main.h"
|
||||
@ -167,29 +167,29 @@ enum {
|
||||
B0_MAGIC_CHAR = 0x55,
|
||||
};
|
||||
|
||||
// Block zero holds all info about the swapfile. This is the first block in the file.
|
||||
//
|
||||
// NOTE: DEFINITION OF BLOCK 0 SHOULD NOT CHANGE! It would make all existing swapfiles unusable!
|
||||
//
|
||||
// If size of block0 changes anyway, adjust MIN_SWAP_PAGE_SIZE in vim.h!!
|
||||
//
|
||||
// This block is built up of single bytes, to make it portable across
|
||||
// different machines. b0_magic_* is used to check the byte order and size of
|
||||
// variables, because the rest of the swapfile is not portable.
|
||||
/// Block zero holds all info about the swapfile. This is the first block in the file.
|
||||
///
|
||||
/// NOTE: DEFINITION OF BLOCK 0 SHOULD NOT CHANGE! It would make all existing swapfiles unusable!
|
||||
///
|
||||
/// If size of block0 changes anyway, adjust MIN_SWAP_PAGE_SIZE in memfile.h!!
|
||||
///
|
||||
/// This block is built up of single bytes, to make it portable across
|
||||
/// different machines. b0_magic_* is used to check the byte order and size of
|
||||
/// variables, because the rest of the swapfile is not portable.
|
||||
typedef struct {
|
||||
char b0_id[2]; ///< ID for block 0: BLOCK0_ID0 and BLOCK0_ID1.
|
||||
char b0_version[10]; // Vim version string
|
||||
char b0_page_size[4]; // number of bytes per page
|
||||
char b0_mtime[4]; // last modification time of file
|
||||
char b0_ino[4]; // inode of b0_fname
|
||||
char b0_pid[4]; // process id of creator (or 0)
|
||||
char b0_uname[B0_UNAME_SIZE]; // name of user (uid if no name)
|
||||
char b0_hname[B0_HNAME_SIZE]; // host name (if it has a name)
|
||||
char b0_fname[B0_FNAME_SIZE_ORG]; // name of file being edited
|
||||
long b0_magic_long; // check for byte order of long
|
||||
int b0_magic_int; // check for byte order of int
|
||||
int16_t b0_magic_short; // check for byte order of short
|
||||
char b0_magic_char; // check for last char
|
||||
char b0_version[10]; ///< Vim version string
|
||||
char b0_page_size[4]; ///< number of bytes per page
|
||||
char b0_mtime[4]; ///< last modification time of file
|
||||
char b0_ino[4]; ///< inode of b0_fname
|
||||
char b0_pid[4]; ///< process id of creator (or 0)
|
||||
char b0_uname[B0_UNAME_SIZE]; ///< name of user (uid if no name)
|
||||
char b0_hname[B0_HNAME_SIZE]; ///< host name (if it has a name)
|
||||
char b0_fname[B0_FNAME_SIZE_ORG]; ///< name of file being edited
|
||||
long b0_magic_long; ///< check for byte order of long
|
||||
int b0_magic_int; ///< check for byte order of int
|
||||
int16_t b0_magic_short; ///< check for byte order of short
|
||||
char b0_magic_char; ///< check for last char
|
||||
} ZeroBlock;
|
||||
|
||||
// Note: b0_dirty and b0_flags are put at the end of the file name. For very
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/sign.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/usercmd.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mbyte.h"
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
|
@ -1,15 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stddef.h> // IWYU pragma: keep
|
||||
#include <stdio.h>
|
||||
|
||||
#include "klib/kvec.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/grid_defs.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
/// Types of dialogs passed to do_dialog().
|
||||
enum {
|
||||
@ -30,6 +30,9 @@ enum {
|
||||
VIM_DISCARDALL = 6,
|
||||
};
|
||||
|
||||
/// special attribute addition: Put message in history
|
||||
enum { MSG_HIST = 0x1000, };
|
||||
|
||||
typedef struct {
|
||||
String text;
|
||||
int attr;
|
||||
@ -77,3 +80,14 @@ EXTERN int msg_listdo_overwrite INIT( = 0);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "message.h.generated.h"
|
||||
#endif
|
||||
|
||||
// Prefer using semsg(), because perror() may send the output to the wrong
|
||||
// destination and mess up the screen.
|
||||
#define PERROR(msg) (void)semsg("%s: %s", (msg), strerror(errno))
|
||||
|
||||
#ifndef MSWIN
|
||||
/// Headless (no UI) error message handler.
|
||||
# define os_errmsg(str) fprintf(stderr, "%s", (str))
|
||||
/// Headless (no UI) message handler.
|
||||
# define os_msg(str) printf("%s", (str))
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/help.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mapping.h"
|
||||
|
@ -64,6 +64,12 @@ enum {
|
||||
CA_NO_ADJ_OP_END = 2, ///< don't adjust operator end
|
||||
};
|
||||
|
||||
/// Replacement for nchar used by nv_replace().
|
||||
enum {
|
||||
REPLACE_CR_NCHAR = -1,
|
||||
REPLACE_NL_NCHAR = -2,
|
||||
};
|
||||
|
||||
/// columns needed by shown command
|
||||
enum { SHOWCMD_COLS = 10, };
|
||||
enum { SHOWCMD_BUFLEN = SHOWCMD_COLS + 1 + 30, };
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/keycodes.h"
|
||||
@ -103,9 +103,9 @@ static const char e_search_pattern_and_expression_register_may_not_contain_two_o
|
||||
#define OPF_LINES 1 // operator always works on lines
|
||||
#define OPF_CHANGE 2 // operator changes text
|
||||
|
||||
// The names of operators.
|
||||
// IMPORTANT: Index must correspond with defines in vim.h!!!
|
||||
// The third field indicates whether the operator always works on lines.
|
||||
/// The names of operators.
|
||||
/// IMPORTANT: Index must correspond with defines in ops.h!!!
|
||||
/// The third field indicates whether the operator always works on lines.
|
||||
static char opchars[][3] = {
|
||||
{ NUL, NUL, 0 }, // OP_NOP
|
||||
{ 'd', NUL, OPF_CHANGE }, // OP_DELETE
|
||||
|
124
src/nvim/ops.h
124
src/nvim/ops.h
@ -1,78 +1,82 @@
|
||||
#pragma once
|
||||
|
||||
#include <lauxlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/extmark_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/normal.h"
|
||||
#include "nvim/option_defs.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/normal_defs.h"
|
||||
#include "nvim/option_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/os/time_defs.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
||||
typedef int (*Indenter)(void);
|
||||
|
||||
// flags for do_put()
|
||||
#define PUT_FIXINDENT 1 // make indent look nice
|
||||
#define PUT_CURSEND 2 // leave cursor after end of new text
|
||||
#define PUT_CURSLINE 4 // leave cursor on last line of new text
|
||||
#define PUT_LINE 8 // put register as lines
|
||||
#define PUT_LINE_SPLIT 16 // split line for linewise register
|
||||
#define PUT_LINE_FORWARD 32 // put linewise register below Visual sel.
|
||||
#define PUT_BLOCK_INNER 64 // in block mode, do not add trailing spaces
|
||||
/// flags for do_put()
|
||||
enum {
|
||||
PUT_FIXINDENT = 1, ///< make indent look nice
|
||||
PUT_CURSEND = 2, ///< leave cursor after end of new text
|
||||
PUT_CURSLINE = 4, ///< leave cursor on last line of new text
|
||||
PUT_LINE = 8, ///< put register as lines
|
||||
PUT_LINE_SPLIT = 16, ///< split line for linewise register
|
||||
PUT_LINE_FORWARD = 32, ///< put linewise register below Visual sel.
|
||||
PUT_BLOCK_INNER = 64, ///< in block mode, do not add trailing spaces
|
||||
};
|
||||
|
||||
// Registers:
|
||||
// 0 = register for latest (unnamed) yank
|
||||
// 1..9 = registers '1' to '9', for deletes
|
||||
// 10..35 = registers 'a' to 'z'
|
||||
// 36 = delete register '-'
|
||||
// 37 = selection register '*'
|
||||
// 38 = clipboard register '+'
|
||||
#define DELETION_REGISTER 36
|
||||
#define NUM_SAVED_REGISTERS 37
|
||||
// The following registers should not be saved in ShaDa file:
|
||||
#define STAR_REGISTER 37
|
||||
#define PLUS_REGISTER 38
|
||||
#define NUM_REGISTERS 39
|
||||
/// Registers:
|
||||
/// 0 = register for latest (unnamed) yank
|
||||
/// 1..9 = registers '1' to '9', for deletes
|
||||
/// 10..35 = registers 'a' to 'z'
|
||||
/// 36 = delete register '-'
|
||||
/// 37 = selection register '*'
|
||||
/// 38 = clipboard register '+'
|
||||
enum {
|
||||
DELETION_REGISTER = 36,
|
||||
NUM_SAVED_REGISTERS = 37,
|
||||
// The following registers should not be saved in ShaDa file:
|
||||
STAR_REGISTER = 37,
|
||||
PLUS_REGISTER = 38,
|
||||
NUM_REGISTERS = 39,
|
||||
};
|
||||
|
||||
// Operator IDs; The order must correspond to opchars[] in ops.c!
|
||||
#define OP_NOP 0 // no pending operation
|
||||
#define OP_DELETE 1 // "d" delete operator
|
||||
#define OP_YANK 2 // "y" yank operator
|
||||
#define OP_CHANGE 3 // "c" change operator
|
||||
#define OP_LSHIFT 4 // "<" left shift operator
|
||||
#define OP_RSHIFT 5 // ">" right shift operator
|
||||
#define OP_FILTER 6 // "!" filter operator
|
||||
#define OP_TILDE 7 // "g~" switch case operator
|
||||
#define OP_INDENT 8 // "=" indent operator
|
||||
#define OP_FORMAT 9 // "gq" format operator
|
||||
#define OP_COLON 10 // ":" colon operator
|
||||
#define OP_UPPER 11 // "gU" make upper case operator
|
||||
#define OP_LOWER 12 // "gu" make lower case operator
|
||||
#define OP_JOIN 13 // "J" join operator, only for Visual mode
|
||||
#define OP_JOIN_NS 14 // "gJ" join operator, only for Visual mode
|
||||
#define OP_ROT13 15 // "g?" rot-13 encoding
|
||||
#define OP_REPLACE 16 // "r" replace chars, only for Visual mode
|
||||
#define OP_INSERT 17 // "I" Insert column, only for Visual mode
|
||||
#define OP_APPEND 18 // "A" Append column, only for Visual mode
|
||||
#define OP_FOLD 19 // "zf" define a fold
|
||||
#define OP_FOLDOPEN 20 // "zo" open folds
|
||||
#define OP_FOLDOPENREC 21 // "zO" open folds recursively
|
||||
#define OP_FOLDCLOSE 22 // "zc" close folds
|
||||
#define OP_FOLDCLOSEREC 23 // "zC" close folds recursively
|
||||
#define OP_FOLDDEL 24 // "zd" delete folds
|
||||
#define OP_FOLDDELREC 25 // "zD" delete folds recursively
|
||||
#define OP_FORMAT2 26 // "gw" format operator, keeps cursor pos
|
||||
#define OP_FUNCTION 27 // "g@" call 'operatorfunc'
|
||||
#define OP_NR_ADD 28 // "<C-A>" Add to the number or alphabetic
|
||||
// character (OP_ADD conflicts with Perl)
|
||||
#define OP_NR_SUB 29 // "<C-X>" Subtract from the number or
|
||||
// alphabetic character
|
||||
/// Operator IDs; The order must correspond to opchars[] in ops.c!
|
||||
enum {
|
||||
OP_NOP = 0, ///< no pending operation
|
||||
OP_DELETE = 1, ///< "d" delete operator
|
||||
OP_YANK = 2, ///< "y" yank operator
|
||||
OP_CHANGE = 3, ///< "c" change operator
|
||||
OP_LSHIFT = 4, ///< "<" left shift operator
|
||||
OP_RSHIFT = 5, ///< ">" right shift operator
|
||||
OP_FILTER = 6, ///< "!" filter operator
|
||||
OP_TILDE = 7, ///< "g~" switch case operator
|
||||
OP_INDENT = 8, ///< "=" indent operator
|
||||
OP_FORMAT = 9, ///< "gq" format operator
|
||||
OP_COLON = 10, ///< ":" colon operator
|
||||
OP_UPPER = 11, ///< "gU" make upper case operator
|
||||
OP_LOWER = 12, ///< "gu" make lower case operator
|
||||
OP_JOIN = 13, ///< "J" join operator, only for Visual mode
|
||||
OP_JOIN_NS = 14, ///< "gJ" join operator, only for Visual mode
|
||||
OP_ROT13 = 15, ///< "g?" rot-13 encoding
|
||||
OP_REPLACE = 16, ///< "r" replace chars, only for Visual mode
|
||||
OP_INSERT = 17, ///< "I" Insert column, only for Visual mode
|
||||
OP_APPEND = 18, ///< "A" Append column, only for Visual mode
|
||||
OP_FOLD = 19, ///< "zf" define a fold
|
||||
OP_FOLDOPEN = 20, ///< "zo" open folds
|
||||
OP_FOLDOPENREC = 21, ///< "zO" open folds recursively
|
||||
OP_FOLDCLOSE = 22, ///< "zc" close folds
|
||||
OP_FOLDCLOSEREC = 23, ///< "zC" close folds recursively
|
||||
OP_FOLDDEL = 24, ///< "zd" delete folds
|
||||
OP_FOLDDELREC = 25, ///< "zD" delete folds recursively
|
||||
OP_FORMAT2 = 26, ///< "gw" format operator, keeps cursor pos
|
||||
OP_FUNCTION = 27, ///< "g@" call 'operatorfunc'
|
||||
OP_NR_ADD = 28, ///< "<C-A>" Add to the number or alphabetic character
|
||||
OP_NR_SUB = 29, ///< "<C-X>" Subtract from the number or alphabetic character
|
||||
};
|
||||
|
||||
/// Flags for get_reg_contents().
|
||||
enum GRegFlags {
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include "nvim/spell.h"
|
||||
#include "nvim/spellfile.h"
|
||||
#include "nvim/spellsuggest.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/tag.h"
|
||||
#include "nvim/terminal.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nvim/profile.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#define READ_BUFFER_SIZE 0xfff
|
||||
#define INPUT_BUFFER_SIZE (READ_BUFFER_SIZE * 4)
|
||||
|
@ -41,6 +41,8 @@
|
||||
// Command-processing buffer. Use large buffers for all platforms.
|
||||
#define CMDBUFFSIZE 1024
|
||||
|
||||
#define ROOT_UID 0
|
||||
|
||||
/// Converts libuv error (negative int) to error description string.
|
||||
#define os_strerror uv_strerror
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/os/fs.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/os_win_console.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/os_win_console.c.generated.h"
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/profile.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/tag.h"
|
||||
#include "nvim/types_defs.h"
|
||||
|
@ -17,6 +17,9 @@
|
||||
#endif
|
||||
#ifdef MSWIN
|
||||
# include <lm.h>
|
||||
|
||||
# include "nvim/mbyte.h"
|
||||
# include "nvim/message.h"
|
||||
#endif
|
||||
|
||||
// All user names (for ~user completion as done by shell).
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "plines.c.generated.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/popupmenu.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/ui_compositor.h"
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/help.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mark.h"
|
||||
@ -252,6 +252,8 @@ static const char *e_current_quickfix_list_was_changed =
|
||||
static const char *e_current_location_list_was_changed =
|
||||
N_("E926: Current location list was changed");
|
||||
|
||||
enum { QF_WINHEIGHT = 10, }; ///< default height for quickfix window
|
||||
|
||||
// Quickfix window check helper macro
|
||||
#define IS_QF_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref == NULL)
|
||||
// Location list window check helper macro
|
||||
|
@ -55,6 +55,9 @@
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/usercmd.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#ifdef USE_CRNL
|
||||
# include "nvim/highlight.h"
|
||||
#endif
|
||||
|
||||
/// Structure used to store info for each sourced file.
|
||||
/// It is shared between do_source() and getsourceline().
|
||||
@ -65,7 +68,7 @@ struct source_cookie {
|
||||
char *nextline; ///< if not NULL: line that was read ahead
|
||||
linenr_T sourcing_lnum; ///< line number of the source file
|
||||
int finished; ///< ":finish" used
|
||||
#if defined(USE_CRNL)
|
||||
#ifdef USE_CRNL
|
||||
int fileformat; ///< EOL_UNKNOWN, EOL_UNIX or EOL_DOS
|
||||
bool error; ///< true if LF found after CR-LF
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/insexpand.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
@ -50,7 +50,9 @@
|
||||
#include "nvim/profile.h"
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/tag.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#include "nvim/window.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/map_defs.h"
|
||||
|
@ -1,14 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct vim_state VimState;
|
||||
|
||||
typedef int (*state_check_callback)(VimState *state);
|
||||
typedef int (*state_execute_callback)(VimState *state, int key);
|
||||
|
||||
struct vim_state {
|
||||
state_check_callback check;
|
||||
state_execute_callback execute;
|
||||
};
|
||||
#include "nvim/state_defs.h" // IWYU pragma: export
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "state.h.generated.h"
|
||||
|
45
src/nvim/state_defs.h
Normal file
45
src/nvim/state_defs.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct vim_state VimState;
|
||||
|
||||
typedef int (*state_check_callback)(VimState *state);
|
||||
typedef int (*state_execute_callback)(VimState *state, int key);
|
||||
|
||||
struct vim_state {
|
||||
state_check_callback check;
|
||||
state_execute_callback execute;
|
||||
};
|
||||
|
||||
/// Values for State
|
||||
///
|
||||
/// The lower bits up to 0x80 are used to distinguish normal/visual/op_pending
|
||||
/// /cmdline/insert/replace/terminal mode. This is used for mapping. If none
|
||||
/// of these bits are set, no mapping is done. See the comment above do_map().
|
||||
/// The upper bits are used to distinguish between other states and variants of
|
||||
/// the base modes.
|
||||
enum {
|
||||
MODE_NORMAL = 0x01, ///< Normal mode, command expected
|
||||
MODE_VISUAL = 0x02, ///< Visual mode - use get_real_state()
|
||||
MODE_OP_PENDING = 0x04, ///< Normal mode, operator is pending - use get_real_state()
|
||||
MODE_CMDLINE = 0x08, ///< Editing the command line
|
||||
MODE_INSERT = 0x10, ///< Insert mode, also for Replace mode
|
||||
MODE_LANGMAP = 0x20, ///< Language mapping, can be combined with MODE_INSERT and MODE_CMDLINE
|
||||
MODE_SELECT = 0x40, ///< Select mode, use get_real_state()
|
||||
MODE_TERMINAL = 0x80, ///< Terminal mode
|
||||
|
||||
MAP_ALL_MODES = 0xff, ///< all mode bits used for mapping
|
||||
|
||||
REPLACE_FLAG = 0x100, ///< Replace mode flag
|
||||
MODE_REPLACE = REPLACE_FLAG | MODE_INSERT,
|
||||
VREPLACE_FLAG = 0x200, ///< Virtual-replace mode flag
|
||||
MODE_VREPLACE = REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT,
|
||||
MODE_LREPLACE = REPLACE_FLAG | MODE_LANGMAP,
|
||||
|
||||
MODE_NORMAL_BUSY = 0x1000 | MODE_NORMAL, ///< Normal mode, busy with a command
|
||||
MODE_HITRETURN = 0x2000 | MODE_NORMAL, ///< waiting for return or command
|
||||
MODE_ASKMORE = 0x3000, ///< Asking if you want --more--
|
||||
MODE_SETWSIZE = 0x4000, ///< window size has changed
|
||||
MODE_EXTERNCMD = 0x5000, ///< executing an external command
|
||||
MODE_SHOWMATCH = 0x6000 | MODE_INSERT, ///< show matching paren
|
||||
MODE_CONFIRM = 0x7000, ///< ":confirm" prompt
|
||||
};
|
@ -37,6 +37,7 @@
|
||||
#include "nvim/plines.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/sign.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/statusline.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/ui.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/help.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/input.h"
|
||||
#include "nvim/insexpand.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
@ -51,6 +51,7 @@
|
||||
#include "nvim/regexp.h"
|
||||
#include "nvim/runtime.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/tag.h"
|
||||
#include "nvim/ui.h"
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/option_defs.h" // IWYU pragma: keep
|
||||
|
||||
enum { LSIZE = 512, }; ///< max. size of a line in the tags file
|
||||
|
||||
/// Values for do_tag().
|
||||
enum {
|
||||
DT_TAG = 1, ///< jump to newer position or same tag again
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/textformat.h"
|
||||
#include "nvim/textobject.h"
|
||||
|
@ -29,11 +29,11 @@
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/option_vars.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/state_defs.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/ui_client.h"
|
||||
#include "nvim/ui_compositor.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/winfloat.h"
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/ui_compositor.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ui_compositor.c.generated.h"
|
||||
|
@ -104,7 +104,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/memline.h"
|
||||
|
@ -6,28 +6,31 @@
|
||||
#include "nvim/mark_defs.h"
|
||||
#include "nvim/pos_defs.h"
|
||||
|
||||
/// Size in bytes of the hash used in the undo file.
|
||||
enum { UNDO_HASH_SIZE = 32, };
|
||||
|
||||
typedef struct u_header u_header_T;
|
||||
|
||||
// Structure to store info about the Visual area.
|
||||
/// Structure to store info about the Visual area.
|
||||
typedef struct {
|
||||
pos_T vi_start; // start pos of last VIsual
|
||||
pos_T vi_end; // end position of last VIsual
|
||||
int vi_mode; // VIsual_mode of last VIsual
|
||||
colnr_T vi_curswant; // MAXCOL from w_curswant
|
||||
pos_T vi_start; ///< start pos of last VIsual
|
||||
pos_T vi_end; ///< end position of last VIsual
|
||||
int vi_mode; ///< VIsual_mode of last VIsual
|
||||
colnr_T vi_curswant; ///< MAXCOL from w_curswant
|
||||
} visualinfo_T;
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
|
||||
typedef struct u_entry u_entry_T;
|
||||
struct u_entry {
|
||||
u_entry_T *ue_next; // pointer to next entry in list
|
||||
linenr_T ue_top; // number of line above undo block
|
||||
linenr_T ue_bot; // number of line below undo block
|
||||
linenr_T ue_lcount; // linecount when u_save called
|
||||
char **ue_array; // array of lines in undo block
|
||||
linenr_T ue_size; // number of lines in ue_array
|
||||
u_entry_T *ue_next; ///< pointer to next entry in list
|
||||
linenr_T ue_top; ///< number of line above undo block
|
||||
linenr_T ue_bot; ///< number of line below undo block
|
||||
linenr_T ue_lcount; ///< linecount when u_save called
|
||||
char **ue_array; ///< array of lines in undo block
|
||||
linenr_T ue_size; ///< number of lines in ue_array
|
||||
#ifdef U_DEBUG
|
||||
int ue_magic; // magic number to check allocation
|
||||
int ue_magic; ///< magic number to check allocation
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -35,40 +38,42 @@ struct u_header {
|
||||
// The following have a pointer and a number. The number is used when reading
|
||||
// the undo file in u_read_undo()
|
||||
union {
|
||||
u_header_T *ptr; // pointer to next undo header in list
|
||||
u_header_T *ptr; ///< pointer to next undo header in list
|
||||
int seq;
|
||||
} uh_next;
|
||||
union {
|
||||
u_header_T *ptr; // pointer to previous header in list
|
||||
u_header_T *ptr; ///< pointer to previous header in list
|
||||
int seq;
|
||||
} uh_prev;
|
||||
union {
|
||||
u_header_T *ptr; // pointer to next header for alt. redo
|
||||
u_header_T *ptr; ///< pointer to next header for alt. redo
|
||||
int seq;
|
||||
} uh_alt_next;
|
||||
union {
|
||||
u_header_T *ptr; // pointer to previous header for alt. redo
|
||||
u_header_T *ptr; ///< pointer to previous header for alt. redo
|
||||
int seq;
|
||||
} uh_alt_prev;
|
||||
int uh_seq; // sequence number, higher == newer undo
|
||||
int uh_walk; // used by undo_time()
|
||||
u_entry_T *uh_entry; // pointer to first entry
|
||||
u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set
|
||||
pos_T uh_cursor; // cursor position before saving
|
||||
int uh_seq; ///< sequence number, higher == newer undo
|
||||
int uh_walk; ///< used by undo_time()
|
||||
u_entry_T *uh_entry; ///< pointer to first entry
|
||||
u_entry_T *uh_getbot_entry; ///< pointer to where ue_bot must be set
|
||||
pos_T uh_cursor; ///< cursor position before saving
|
||||
colnr_T uh_cursor_vcol;
|
||||
int uh_flags; // see below
|
||||
fmark_T uh_namedm[NMARKS]; // marks before undo/after redo
|
||||
extmark_undo_vec_t uh_extmark; // info to move extmarks
|
||||
visualinfo_T uh_visual; // Visual areas before undo/after redo
|
||||
time_t uh_time; // timestamp when the change was made
|
||||
int uh_save_nr; // set when the file was saved after the
|
||||
// changes in this block
|
||||
int uh_flags; ///< see below
|
||||
fmark_T uh_namedm[NMARKS]; ///< marks before undo/after redo
|
||||
extmark_undo_vec_t uh_extmark; ///< info to move extmarks
|
||||
visualinfo_T uh_visual; ///< Visual areas before undo/after redo
|
||||
time_t uh_time; ///< timestamp when the change was made
|
||||
int uh_save_nr; ///< set when the file was saved after the
|
||||
///< changes in this block
|
||||
#ifdef U_DEBUG
|
||||
int uh_magic; // magic number to check allocation
|
||||
int uh_magic; ///< magic number to check allocation
|
||||
#endif
|
||||
};
|
||||
|
||||
// values for uh_flags
|
||||
#define UH_CHANGED 0x01 // b_changed flag before undo/after redo
|
||||
#define UH_EMPTYBUF 0x02 // buffer was empty
|
||||
#define UH_RELOAD 0x04 // buffer was reloaded
|
||||
/// values for uh_flags
|
||||
enum {
|
||||
UH_CHANGED = 0x01, ///< b_changed flag before undo/after redo
|
||||
UH_EMPTYBUF = 0x02, ///< buffer was empty
|
||||
UH_RELOAD = 0x04, ///< buffer was reloaded
|
||||
};
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memory.h"
|
||||
|
@ -34,57 +34,17 @@ enum { NUMBUFLEN = 65, };
|
||||
|
||||
#define MAX_TYPENR 65535
|
||||
|
||||
#define ROOT_UID 0
|
||||
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
|
||||
// special attribute addition: Put message in history
|
||||
#define MSG_HIST 0x1000
|
||||
|
||||
// Values for State
|
||||
//
|
||||
// The lower bits up to 0x80 are used to distinguish normal/visual/op_pending
|
||||
// /cmdline/insert/replace/terminal mode. This is used for mapping. If none
|
||||
// of these bits are set, no mapping is done. See the comment above do_map().
|
||||
// The upper bits are used to distinguish between other states and variants of
|
||||
// the base modes.
|
||||
|
||||
#define MODE_NORMAL 0x01 // Normal mode, command expected
|
||||
#define MODE_VISUAL 0x02 // Visual mode - use get_real_state()
|
||||
#define MODE_OP_PENDING 0x04 // Normal mode, operator is pending - use
|
||||
// get_real_state()
|
||||
#define MODE_CMDLINE 0x08 // Editing the command line
|
||||
#define MODE_INSERT 0x10 // Insert mode, also for Replace mode
|
||||
#define MODE_LANGMAP 0x20 // Language mapping, can be combined with
|
||||
// MODE_INSERT and MODE_CMDLINE
|
||||
#define MODE_SELECT 0x40 // Select mode, use get_real_state()
|
||||
#define MODE_TERMINAL 0x80 // Terminal mode
|
||||
|
||||
#define MAP_ALL_MODES 0xff // all mode bits used for mapping
|
||||
|
||||
#define REPLACE_FLAG 0x100 // Replace mode flag
|
||||
#define MODE_REPLACE (REPLACE_FLAG | MODE_INSERT)
|
||||
#define VREPLACE_FLAG 0x200 // Virtual-replace mode flag
|
||||
#define MODE_VREPLACE (REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT)
|
||||
#define MODE_LREPLACE (REPLACE_FLAG | MODE_LANGMAP)
|
||||
|
||||
#define MODE_NORMAL_BUSY (0x1000 | MODE_NORMAL) // Normal mode, busy with a command
|
||||
#define MODE_HITRETURN (0x2000 | MODE_NORMAL) // waiting for return or command
|
||||
#define MODE_ASKMORE 0x3000 // Asking if you want --more--
|
||||
#define MODE_SETWSIZE 0x4000 // window size has changed
|
||||
#define MODE_EXTERNCMD 0x5000 // executing an external command
|
||||
#define MODE_SHOWMATCH (0x6000 | MODE_INSERT) // show matching paren
|
||||
#define MODE_CONFIRM 0x7000 // ":confirm" prompt
|
||||
|
||||
/// Directions.
|
||||
typedef enum {
|
||||
kDirectionNotSet = 0,
|
||||
FORWARD = 1,
|
||||
BACKWARD = (-1),
|
||||
BACKWARD = -1,
|
||||
FORWARD_FILE = 3,
|
||||
BACKWARD_FILE = (-3),
|
||||
BACKWARD_FILE = -3,
|
||||
} Direction;
|
||||
|
||||
// return values for functions
|
||||
@ -95,36 +55,6 @@ typedef enum {
|
||||
#define FAIL 0
|
||||
#define NOTDONE 2 // not OK or FAIL but skipped
|
||||
|
||||
// Minimal size for block 0 of a swap file.
|
||||
// NOTE: This depends on size of struct block0! It's not done with a sizeof(),
|
||||
// because struct block0 is defined in memline.c (Sorry).
|
||||
// The maximal block size is arbitrary.
|
||||
#define MIN_SWAP_PAGE_SIZE 1048
|
||||
#define MAX_SWAP_PAGE_SIZE 50000
|
||||
|
||||
#define STATUS_HEIGHT 1 // height of a status line under a window
|
||||
#define QF_WINHEIGHT 10 // default height for quickfix window
|
||||
|
||||
// Buffer sizes
|
||||
|
||||
#ifndef CMDBUFFSIZE
|
||||
# define CMDBUFFSIZE 256 // size of the command processing buffer
|
||||
#endif
|
||||
|
||||
#define LSIZE 512 // max. size of a line in the tags file
|
||||
|
||||
#define DIALOG_MSG_SIZE 1000 // buffer size for dialog_msg()
|
||||
|
||||
enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
|
||||
|
||||
// Maximum length of key sequence to be mapped.
|
||||
// Must be able to hold an Amiga resize report.
|
||||
|
||||
#define MAXMAPLEN 50
|
||||
|
||||
// Size in bytes of the hash used in the undo file.
|
||||
#define UNDO_HASH_SIZE 32
|
||||
|
||||
#define CLEAR_FIELD(field) memset(&(field), 0, sizeof(field))
|
||||
#define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr)))
|
||||
|
||||
@ -160,45 +90,8 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
|
||||
|
||||
#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
||||
|
||||
// Character used as separated in autoload function/variable names.
|
||||
#define AUTOLOAD_CHAR '#'
|
||||
|
||||
#include "nvim/message.h"
|
||||
|
||||
// Prefer using semsg(), because perror() may send the output to the wrong
|
||||
// destination and mess up the screen.
|
||||
#define PERROR(msg) (void)semsg("%s: %s", (msg), strerror(errno))
|
||||
|
||||
#include "nvim/path.h"
|
||||
|
||||
// Enums need a typecast to be used as array index.
|
||||
#define HL_ATTR(n) hl_attr_active[(int)(n)]
|
||||
|
||||
/// Maximum number of bytes in a multi-byte character. It can be one 32-bit
|
||||
/// character of up to 6 bytes, or one 16-bit character of up to three bytes
|
||||
/// plus six following composing characters of three bytes each.
|
||||
#define MB_MAXBYTES 21
|
||||
|
||||
#ifndef MSWIN
|
||||
/// Headless (no UI) error message handler.
|
||||
# define os_errmsg(str) fprintf(stderr, "%s", (str))
|
||||
/// Headless (no UI) message handler.
|
||||
# define os_msg(str) printf("%s", (str))
|
||||
#endif
|
||||
|
||||
#include "nvim/buffer_defs.h" // buffer and windows
|
||||
#include "nvim/ex_cmds_defs.h" // Ex command defines
|
||||
#include "nvim/globals.h" // global variables and messages
|
||||
|
||||
// Lowest number used for window ID. Cannot have this many windows per tab.
|
||||
#define LOWEST_WIN_ID 1000
|
||||
|
||||
// BSD is supposed to cover FreeBSD and similar systems.
|
||||
#if (defined(BSD) || defined(__FreeBSD_kernel__)) \
|
||||
&& (defined(S_ISCHR) || defined(S_IFCHR))
|
||||
# define OPEN_CHR_FILES
|
||||
#endif
|
||||
|
||||
// Replacement for nchar used by nv_replace().
|
||||
#define REPLACE_CR_NCHAR (-1)
|
||||
#define REPLACE_NL_NCHAR (-2)
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/assert_defs.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/gettext.h"
|
||||
#include "nvim/keycodes.h"
|
||||
@ -65,7 +66,6 @@
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#include "nvim/viml/parser/expressions.h"
|
||||
#include "nvim/viml/parser/parser.h"
|
||||
|
||||
|
@ -32,12 +32,15 @@ enum {
|
||||
WSP_NEWLOC = 0x100, ///< don't copy location list
|
||||
};
|
||||
|
||||
/// Minimum screen size
|
||||
enum {
|
||||
MIN_COLUMNS = 12, ///< minimal columns for screen
|
||||
MIN_LINES = 2, ///< minimal lines for screen
|
||||
MIN_COLUMNS = 12, ///< minimal columns for screen
|
||||
MIN_LINES = 2, ///< minimal lines for screen
|
||||
STATUS_HEIGHT = 1, ///< height of a status line under a window
|
||||
};
|
||||
|
||||
/// Lowest number used for window ID. Cannot have this many windows per tab.
|
||||
enum { LOWEST_WIN_ID = 1000, };
|
||||
|
||||
/// Set to true if 'cmdheight' was explicitly set to 0.
|
||||
EXTERN bool p_ch_was_zero INIT( = false);
|
||||
|
||||
|
@ -487,7 +487,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
||||
end)
|
||||
|
||||
it('error if LHS longer than MAXMAPLEN', function()
|
||||
-- assume MAXMAPLEN of 50 chars, as declared in vim.h
|
||||
-- assume MAXMAPLEN of 50 chars, as declared in mapping_defs.h
|
||||
local MAXMAPLEN = 50
|
||||
local lhs = ''
|
||||
for i=1,MAXMAPLEN do
|
||||
|
@ -199,7 +199,7 @@ describe('server -> client', function()
|
||||
|
||||
it('can communicate buffers, tabpages, and windows', function()
|
||||
eq({1}, eval("rpcrequest(vim, 'nvim_list_tabpages')"))
|
||||
-- Window IDs start at 1000 (LOWEST_WIN_ID in vim.h)
|
||||
-- Window IDs start at 1000 (LOWEST_WIN_ID in window.h)
|
||||
eq({1000}, eval("rpcrequest(vim, 'nvim_list_wins')"))
|
||||
|
||||
local buf = eval("rpcrequest(vim, 'nvim_list_bufs')")[1]
|
||||
|
Loading…
Reference in New Issue
Block a user