aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 15:00:41 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 15:00:41 -0700
commit7a7f497b483cd65e340064f23ed1c73425ecba0a (patch)
treed5c99ea22a1e10300d06165f8ac96df6b0dc59e1 /src/nvim/ops.h
parent1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.gz
rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.bz2
rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpost
Diffstat (limited to 'src/nvim/ops.h')
-rw-r--r--src/nvim/ops.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 67a613cbca..1a708fab03 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -15,6 +15,25 @@
#include "nvim/pos_defs.h"
#include "nvim/types_defs.h"
+/// structure used by block_prep, op_delete and op_yank for blockwise operators
+/// also op_change, op_shift, op_insert, op_replace - AKelly
+struct block_def {
+ int startspaces; ///< 'extra' cols before first char
+ int endspaces; ///< 'extra' cols after last char
+ int textlen; ///< chars in block
+ char *textstart; ///< pointer to 1st char (partially) in block
+ colnr_T textcol; ///< index of chars (partially) in block
+ colnr_T start_vcol; ///< start col of 1st char wholly inside block
+ colnr_T end_vcol; ///< start col of 1st char wholly after block
+ int is_short; ///< true if line is too short to fit in block
+ int is_MAX; ///< true if curswant==MAXCOL when starting
+ int is_oneChar; ///< true if block within one character
+ int pre_whitesp; ///< screen cols of ws before block
+ int pre_whitesp_c; ///< chars of ws before block
+ colnr_T end_char_vcols; ///< number of vcols of post-block char
+ colnr_T start_char_vcols; ///< number of vcols of pre-block char
+};
+
typedef int (*Indenter)(void);
/// flags for do_put()
@@ -86,7 +105,7 @@ enum GRegFlags {
};
/// Definition of one register
-typedef struct yankreg {
+typedef struct {
char **y_array; ///< Pointer to an array of line pointers.
size_t y_size; ///< Number of lines in y_array.
MotionType y_type; ///< Register type
@@ -102,13 +121,15 @@ typedef enum {
YREG_PUT,
} yreg_mode_t;
+static inline int op_reg_index(int regname)
+ REAL_FATTR_CONST;
+
/// Convert register name into register index
///
/// @param[in] regname Register name.
///
/// @return Index in y_regs array or -1 if register name was not recognized.
static inline int op_reg_index(const int regname)
- FUNC_ATTR_CONST
{
if (ascii_isdigit(regname)) {
return regname - '0';
@@ -127,11 +148,13 @@ static inline int op_reg_index(const int regname)
}
}
+static inline bool is_literal_register(int regname)
+ REAL_FATTR_CONST;
+
/// @see get_yank_register
/// @return true when register should be inserted literally
/// (selection or clipboard)
static inline bool is_literal_register(const int regname)
- FUNC_ATTR_CONST
{
return regname == '*' || regname == '+';
}