aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ops.h')
-rw-r--r--src/nvim/ops.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 67a613cbca..643d2a2deb 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -15,10 +15,30 @@
#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()
enum {
+ ITER_REGISTER_NULL = 0,
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
@@ -42,6 +62,7 @@ enum {
STAR_REGISTER = 37,
PLUS_REGISTER = 38,
NUM_REGISTERS = 39,
+ USER_REGISTERS_START = 39
};
/// Operator IDs; The order must correspond to opchars[] in ops.c!
@@ -86,7 +107,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
@@ -101,6 +122,11 @@ typedef enum {
YREG_YANK,
YREG_PUT,
} yreg_mode_t;
+/// Returns a reference to a user-defined register.
+int get_userreg(int regname);
+
+static inline int op_reg_index(int regname)
+ REAL_FATTR_CONST;
/// Convert register name into register index
///
@@ -108,7 +134,6 @@ typedef enum {
///
/// @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';
@@ -123,15 +148,21 @@ static inline int op_reg_index(const int regname)
} else if (regname == '+') {
return PLUS_REGISTER;
} else {
- return -1;
+ return get_userreg(regname);
}
}
+struct yank_registers;
+typedef struct yank_registers yank_registers_T;
+
+typedef size_t iter_register_T;
+
+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 == '+';
}