normal.h 3.47 KB
Newer Older
1 2
#ifndef NVIM_NORMAL_H
#define NVIM_NORMAL_H
3

4
#include <stdbool.h>
5
#include "nvim/pos.h"
6
#include "nvim/buffer_defs.h"  // for win_T
7

8 9 10 11 12
/* Values for find_ident_under_cursor() */
#define FIND_IDENT      1       /* find identifier (word) */
#define FIND_STRING     2       /* find any string (WORD) */
#define FIND_EVAL       4       /* include "->", "[]" and "." */

13 14 15 16 17 18 19 20 21 22 23
/// 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;

24 25 26 27
/*
 * Arguments for operators.
 */
typedef struct oparg_S {
28 29
  int op_type;                  // current pending operator type
  int regname;                  // register to use for the operator
30
  MotionType motion_type;       // type of the current cursor motion
31 32 33 34
  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
35
                                // valid when motion_type is kMTCharWise)
36 37 38 39 40
  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"
41

42 43 44 45 46 47 48
  long 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
49 50
  long prev_opcount;            // ca.opcount saved for K_EVENT
  long prev_count0;             // ca.count0 saved for K_EVENT
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
} 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) */
  long opcount;                 /* count before an operator */
  long count0;                  /* count before command, default 0 */
  long count1;                  /* count before command, default 1 */
  int arg;                      /* extra argument from nv_cmds[] */
  int retval;                   /* return: CA_* values */
  char_u      *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 */

76

77 78 79
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "normal.h.generated.h"
#endif
ZyX's avatar
ZyX committed
80
#endif  // NVIM_NORMAL_H