diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-03-10 01:38:21 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-10 05:55:59 -0300 |
commit | 1684bec63571583f14065cfb614153df125b97e8 (patch) | |
tree | 7ff3a8f029619516115a5f76f63d580a172461de /src | |
parent | 6089b2601678977122c0139bba77913e55cfb56e (diff) | |
download | rneovim-1684bec63571583f14065cfb614153df125b97e8.tar.gz rneovim-1684bec63571583f14065cfb614153df125b97e8.tar.bz2 rneovim-1684bec63571583f14065cfb614153df125b97e8.zip |
Extract cursor_shape.c from misc2.c and types/consts from structs.h
Diffstat (limited to 'src')
-rw-r--r-- | src/cursor_shape.c | 247 | ||||
-rw-r--r-- | src/cursor_shape.h | 56 | ||||
-rw-r--r-- | src/ex_getln.c | 2 | ||||
-rw-r--r-- | src/globals.h | 5 | ||||
-rw-r--r-- | src/misc2.c | 244 | ||||
-rw-r--r-- | src/misc2.h | 3 | ||||
-rw-r--r-- | src/option.c | 1 | ||||
-rw-r--r-- | src/structs.h | 48 |
8 files changed, 306 insertions, 300 deletions
diff --git a/src/cursor_shape.c b/src/cursor_shape.c new file mode 100644 index 0000000000..6ee1b237a0 --- /dev/null +++ b/src/cursor_shape.c @@ -0,0 +1,247 @@ +#include "vim.h" +#include "cursor_shape.h" +#include "misc2.h" +#include "charset.h" +#include "syntax.h" + +#if defined(CURSOR_SHAPE) || defined(PROTO) + +/* + * Handling of cursor and mouse pointer shapes in various modes. + */ + +static cursorentry_T shape_table[SHAPE_IDX_COUNT] = +{ + /* The values will be filled in from the 'guicursor' and 'mouseshape' + * defaults when Vim starts. + * Adjust the SHAPE_IDX_ defines when making changes! */ + {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE}, + {0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE}, + {0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR}, +}; + +/* + * Parse the 'guicursor' option ("what" is SHAPE_CURSOR) or 'mouseshape' + * ("what" is SHAPE_MOUSE). + * Returns error message for an illegal option, NULL otherwise. + */ +char_u *parse_shape_opt(int what) +{ + char_u *modep; + char_u *colonp; + char_u *commap; + char_u *slashp; + char_u *p, *endp; + int idx = 0; /* init for GCC */ + int all_idx; + int len; + int i; + long n; + int found_ve = FALSE; /* found "ve" flag */ + int round; + + /* + * First round: check for errors; second round: do it for real. + */ + for (round = 1; round <= 2; ++round) { + /* + * Repeat for all comma separated parts. + */ + modep = p_guicursor; + while (*modep != NUL) { + colonp = vim_strchr(modep, ':'); + if (colonp == NULL) + return (char_u *)N_("E545: Missing colon"); + if (colonp == modep) + return (char_u *)N_("E546: Illegal mode"); + commap = vim_strchr(modep, ','); + + /* + * Repeat for all mode's before the colon. + * For the 'a' mode, we loop to handle all the modes. + */ + all_idx = -1; + while (modep < colonp || all_idx >= 0) { + if (all_idx < 0) { + /* Find the mode. */ + if (modep[1] == '-' || modep[1] == ':') + len = 1; + else + len = 2; + if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') + all_idx = SHAPE_IDX_COUNT - 1; + else { + for (idx = 0; idx < SHAPE_IDX_COUNT; ++idx) + if (STRNICMP(modep, shape_table[idx].name, len) + == 0) + break; + if (idx == SHAPE_IDX_COUNT + || (shape_table[idx].used_for & what) == 0) + return (char_u *)N_("E546: Illegal mode"); + if (len == 2 && modep[0] == 'v' && modep[1] == 'e') + found_ve = TRUE; + } + modep += len + 1; + } + + if (all_idx >= 0) + idx = all_idx--; + else if (round == 2) { + { + /* Set the defaults, for the missing parts */ + shape_table[idx].shape = SHAPE_BLOCK; + shape_table[idx].blinkwait = 700L; + shape_table[idx].blinkon = 400L; + shape_table[idx].blinkoff = 250L; + } + } + + /* Parse the part after the colon */ + for (p = colonp + 1; *p && *p != ','; ) { + { + /* + * First handle the ones with a number argument. + */ + i = *p; + len = 0; + if (STRNICMP(p, "ver", 3) == 0) + len = 3; + else if (STRNICMP(p, "hor", 3) == 0) + len = 3; + else if (STRNICMP(p, "blinkwait", 9) == 0) + len = 9; + else if (STRNICMP(p, "blinkon", 7) == 0) + len = 7; + else if (STRNICMP(p, "blinkoff", 8) == 0) + len = 8; + if (len != 0) { + p += len; + if (!VIM_ISDIGIT(*p)) + return (char_u *)N_("E548: digit expected"); + n = getdigits(&p); + if (len == 3) { /* "ver" or "hor" */ + if (n == 0) + return (char_u *)N_("E549: Illegal percentage"); + if (round == 2) { + if (TOLOWER_ASC(i) == 'v') + shape_table[idx].shape = SHAPE_VER; + else + shape_table[idx].shape = SHAPE_HOR; + shape_table[idx].percentage = n; + } + } else if (round == 2) { + if (len == 9) + shape_table[idx].blinkwait = n; + else if (len == 7) + shape_table[idx].blinkon = n; + else + shape_table[idx].blinkoff = n; + } + } else if (STRNICMP(p, "block", 5) == 0) { + if (round == 2) + shape_table[idx].shape = SHAPE_BLOCK; + p += 5; + } else { /* must be a highlight group name then */ + endp = vim_strchr(p, '-'); + if (commap == NULL) { /* last part */ + if (endp == NULL) + endp = p + STRLEN(p); /* find end of part */ + } else if (endp > commap || endp == NULL) + endp = commap; + slashp = vim_strchr(p, '/'); + if (slashp != NULL && slashp < endp) { + /* "group/langmap_group" */ + i = syn_check_group(p, (int)(slashp - p)); + p = slashp + 1; + } + if (round == 2) { + shape_table[idx].id = syn_check_group(p, + (int)(endp - p)); + shape_table[idx].id_lm = shape_table[idx].id; + if (slashp != NULL && slashp < endp) + shape_table[idx].id = i; + } + p = endp; + } + } /* if (what != SHAPE_MOUSE) */ + + if (*p == '-') + ++p; + } + } + modep = p; + if (*modep == ',') + ++modep; + } + } + + /* If the 's' flag is not given, use the 'v' cursor for 's' */ + if (!found_ve) { + { + shape_table[SHAPE_IDX_VE].shape = shape_table[SHAPE_IDX_V].shape; + shape_table[SHAPE_IDX_VE].percentage = + shape_table[SHAPE_IDX_V].percentage; + shape_table[SHAPE_IDX_VE].blinkwait = + shape_table[SHAPE_IDX_V].blinkwait; + shape_table[SHAPE_IDX_VE].blinkon = + shape_table[SHAPE_IDX_V].blinkon; + shape_table[SHAPE_IDX_VE].blinkoff = + shape_table[SHAPE_IDX_V].blinkoff; + shape_table[SHAPE_IDX_VE].id = shape_table[SHAPE_IDX_V].id; + shape_table[SHAPE_IDX_VE].id_lm = shape_table[SHAPE_IDX_V].id_lm; + } + } + + return NULL; +} + +# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \ + || defined(FEAT_MOUSESHAPE) || defined(PROTO) +/* + * Return the index into shape_table[] for the current mode. + * When "mouse" is TRUE, consider indexes valid for the mouse pointer. + */ +int get_shape_idx(int mouse) +{ + if (!mouse && State == SHOWMATCH) + return SHAPE_IDX_SM; + if (State & VREPLACE_FLAG) + return SHAPE_IDX_R; + if (State & REPLACE_FLAG) + return SHAPE_IDX_R; + if (State & INSERT) + return SHAPE_IDX_I; + if (State & CMDLINE) { + if (cmdline_at_end()) + return SHAPE_IDX_C; + if (cmdline_overstrike()) + return SHAPE_IDX_CR; + return SHAPE_IDX_CI; + } + if (finish_op) + return SHAPE_IDX_O; + if (VIsual_active) { + if (*p_sel == 'e') + return SHAPE_IDX_VE; + else + return SHAPE_IDX_V; + } + return SHAPE_IDX_N; +} +#endif + +#endif /* CURSOR_SHAPE */ diff --git a/src/cursor_shape.h b/src/cursor_shape.h new file mode 100644 index 0000000000..41c15d0205 --- /dev/null +++ b/src/cursor_shape.h @@ -0,0 +1,56 @@ +#ifndef NEOVIM_CURSOR_SHAPE_H +#define NEOVIM_CURSOR_SHAPE_H + +#ifdef CURSOR_SHAPE +/* + * struct to store values from 'guicursor' and 'mouseshape' + */ +/* Indexes in shape_table[] */ +#define SHAPE_IDX_N 0 /* Normal mode */ +#define SHAPE_IDX_V 1 /* Visual mode */ +#define SHAPE_IDX_I 2 /* Insert mode */ +#define SHAPE_IDX_R 3 /* Replace mode */ +#define SHAPE_IDX_C 4 /* Command line Normal mode */ +#define SHAPE_IDX_CI 5 /* Command line Insert mode */ +#define SHAPE_IDX_CR 6 /* Command line Replace mode */ +#define SHAPE_IDX_O 7 /* Operator-pending mode */ +#define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */ +#define SHAPE_IDX_CLINE 9 /* On command line */ +#define SHAPE_IDX_STATUS 10 /* A status line */ +#define SHAPE_IDX_SDRAG 11 /* dragging a status line */ +#define SHAPE_IDX_VSEP 12 /* A vertical separator line */ +#define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */ +#define SHAPE_IDX_MORE 14 /* Hit-return or More */ +#define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */ +#define SHAPE_IDX_SM 16 /* showing matching paren */ +#define SHAPE_IDX_COUNT 17 + +#define SHAPE_BLOCK 0 /* block cursor */ +#define SHAPE_HOR 1 /* horizontal bar cursor */ +#define SHAPE_VER 2 /* vertical bar cursor */ + +#define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */ +#define MSHAPE_HIDE 1 /* hide mouse pointer */ + +#define SHAPE_MOUSE 1 /* used for mouse pointer shape */ +#define SHAPE_CURSOR 2 /* used for text cursor shape */ + +typedef struct cursor_entry { + int shape; /* one of the SHAPE_ defines */ + int mshape; /* one of the MSHAPE defines */ + int percentage; /* percentage of cell for bar */ + long blinkwait; /* blinking, wait time before blinking starts */ + long blinkon; /* blinking, on time */ + long blinkoff; /* blinking, off time */ + int id; /* highlight group ID */ + int id_lm; /* highlight group ID for :lmap mode */ + char *name; /* mode name (fixed) */ + char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */ +} cursorentry_T; +#endif /* CURSOR_SHAPE */ + +char_u *parse_shape_opt(int what); +int get_shape_idx(int mouse); +void update_mouseshape(int shape_idx); + +#endif /* NEOVIM_CURSOR_SHAPE_H */ diff --git a/src/ex_getln.c b/src/ex_getln.c index fc5a445c2c..3b188f1a20 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -33,6 +33,7 @@ #include "message.h" #include "misc1.h" #include "misc2.h" +#include "cursor_shape.h" #include "keymap.h" #include "garray.h" #include "move.h" @@ -46,6 +47,7 @@ #include "tag.h" #include "term.h" #include "window.h" +#include "ui.h" #include "os/os.h" /* diff --git a/src/globals.h b/src/globals.h index 91c22061e1..6b158f5d9b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -944,11 +944,6 @@ EXTERN int stl_syntax INIT(= 0); EXTERN int no_hlsearch INIT(= FALSE); -#ifdef CURSOR_SHAPE -/* the table is in misc2.c, because of initializations */ -extern cursorentry_T shape_table[SHAPE_IDX_COUNT]; -#endif - /* * Printer stuff shared between hardcopy.c and machine-specific printing code. */ diff --git a/src/misc2.c b/src/misc2.c index 0fce70759d..dd3c7363da 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1858,250 +1858,6 @@ int illegal_slash(char *name) } #endif -#if defined(CURSOR_SHAPE) || defined(PROTO) - -/* - * Handling of cursor and mouse pointer shapes in various modes. - */ - -cursorentry_T shape_table[SHAPE_IDX_COUNT] = -{ - /* The values will be filled in from the 'guicursor' and 'mouseshape' - * defaults when Vim starts. - * Adjust the SHAPE_IDX_ defines when making changes! */ - {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE}, - {0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR}, -}; - - -/* - * Parse the 'guicursor' option ("what" is SHAPE_CURSOR) or 'mouseshape' - * ("what" is SHAPE_MOUSE). - * Returns error message for an illegal option, NULL otherwise. - */ -char_u *parse_shape_opt(int what) -{ - char_u *modep; - char_u *colonp; - char_u *commap; - char_u *slashp; - char_u *p, *endp; - int idx = 0; /* init for GCC */ - int all_idx; - int len; - int i; - long n; - int found_ve = FALSE; /* found "ve" flag */ - int round; - - /* - * First round: check for errors; second round: do it for real. - */ - for (round = 1; round <= 2; ++round) { - /* - * Repeat for all comma separated parts. - */ - modep = p_guicursor; - while (*modep != NUL) { - colonp = vim_strchr(modep, ':'); - if (colonp == NULL) - return (char_u *)N_("E545: Missing colon"); - if (colonp == modep) - return (char_u *)N_("E546: Illegal mode"); - commap = vim_strchr(modep, ','); - - /* - * Repeat for all mode's before the colon. - * For the 'a' mode, we loop to handle all the modes. - */ - all_idx = -1; - while (modep < colonp || all_idx > = 0) { - if (all_idx < 0) { - /* Find the mode. */ - if (modep[1] == '-' || modep[1] == ':') - len = 1; - else - len = 2; - if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') - all_idx = SHAPE_IDX_COUNT - 1; - else { - for (idx = 0; idx < SHAPE_IDX_COUNT; ++idx) - if (STRNICMP(modep, shape_table[idx].name, len) - == 0) - break; - if (idx == SHAPE_IDX_COUNT - || (shape_table[idx].used_for & what) == 0) - return (char_u *)N_("E546: Illegal mode"); - if (len == 2 && modep[0] == 'v' && modep[1] == 'e') - found_ve = TRUE; - } - modep += len + 1; - } - - if (all_idx >= 0) - idx = all_idx--; - else if (round == 2) { - { - /* Set the defaults, for the missing parts */ - shape_table[idx].shape = SHAPE_BLOCK; - shape_table[idx].blinkwait = 700L; - shape_table[idx].blinkon = 400L; - shape_table[idx].blinkoff = 250L; - } - } - - /* Parse the part after the colon */ - for (p = colonp + 1; *p && *p != ','; ) { - { - /* - * First handle the ones with a number argument. - */ - i = *p; - len = 0; - if (STRNICMP(p, "ver", 3) == 0) - len = 3; - else if (STRNICMP(p, "hor", 3) == 0) - len = 3; - else if (STRNICMP(p, "blinkwait", 9) == 0) - len = 9; - else if (STRNICMP(p, "blinkon", 7) == 0) - len = 7; - else if (STRNICMP(p, "blinkoff", 8) == 0) - len = 8; - if (len != 0) { - p += len; - if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E548: digit expected"); - n = getdigits(&p); - if (len == 3) { /* "ver" or "hor" */ - if (n == 0) - return (char_u *)N_("E549: Illegal percentage"); - if (round == 2) { - if (TOLOWER_ASC(i) == 'v') - shape_table[idx].shape = SHAPE_VER; - else - shape_table[idx].shape = SHAPE_HOR; - shape_table[idx].percentage = n; - } - } else if (round == 2) { - if (len == 9) - shape_table[idx].blinkwait = n; - else if (len == 7) - shape_table[idx].blinkon = n; - else - shape_table[idx].blinkoff = n; - } - } else if (STRNICMP(p, "block", 5) == 0) { - if (round == 2) - shape_table[idx].shape = SHAPE_BLOCK; - p += 5; - } else { /* must be a highlight group name then */ - endp = vim_strchr(p, '-'); - if (commap == NULL) { /* last part */ - if (endp == NULL) - endp = p + STRLEN(p); /* find end of part */ - } else if (endp > commap || endp == NULL) - endp = commap; - slashp = vim_strchr(p, '/'); - if (slashp != NULL && slashp < endp) { - /* "group/langmap_group" */ - i = syn_check_group(p, (int)(slashp - p)); - p = slashp + 1; - } - if (round == 2) { - shape_table[idx].id = syn_check_group(p, - (int)(endp - p)); - shape_table[idx].id_lm = shape_table[idx].id; - if (slashp != NULL && slashp < endp) - shape_table[idx].id = i; - } - p = endp; - } - } /* if (what != SHAPE_MOUSE) */ - - if (*p == '-') - ++p; - } - } - modep = p; - if (*modep == ',') - ++modep; - } - } - - /* If the 's' flag is not given, use the 'v' cursor for 's' */ - if (!found_ve) { - { - shape_table[SHAPE_IDX_VE].shape = shape_table[SHAPE_IDX_V].shape; - shape_table[SHAPE_IDX_VE].percentage = - shape_table[SHAPE_IDX_V].percentage; - shape_table[SHAPE_IDX_VE].blinkwait = - shape_table[SHAPE_IDX_V].blinkwait; - shape_table[SHAPE_IDX_VE].blinkon = - shape_table[SHAPE_IDX_V].blinkon; - shape_table[SHAPE_IDX_VE].blinkoff = - shape_table[SHAPE_IDX_V].blinkoff; - shape_table[SHAPE_IDX_VE].id = shape_table[SHAPE_IDX_V].id; - shape_table[SHAPE_IDX_VE].id_lm = shape_table[SHAPE_IDX_V].id_lm; - } - } - - return NULL; -} - -# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \ - || defined(FEAT_MOUSESHAPE) || defined(PROTO) -/* - * Return the index into shape_table[] for the current mode. - * When "mouse" is TRUE, consider indexes valid for the mouse pointer. - */ -int get_shape_idx(int mouse) -{ - if (!mouse && State == SHOWMATCH) - return SHAPE_IDX_SM; - if (State & VREPLACE_FLAG) - return SHAPE_IDX_R; - if (State & REPLACE_FLAG) - return SHAPE_IDX_R; - if (State & INSERT) - return SHAPE_IDX_I; - if (State & CMDLINE) { - if (cmdline_at_end()) - return SHAPE_IDX_C; - if (cmdline_overstrike()) - return SHAPE_IDX_CR; - return SHAPE_IDX_CI; - } - if (finish_op) - return SHAPE_IDX_O; - if (VIsual_active) { - if (*p_sel == 'e') - return SHAPE_IDX_VE; - else - return SHAPE_IDX_V; - } - return SHAPE_IDX_N; -} -#endif - - -#endif /* CURSOR_SHAPE */ - /* * Change directory to "new_dir". If FEAT_SEARCHPATH is defined, search * 'cdpath' for relative directory names, otherwise just mch_chdir(). diff --git a/src/misc2.h b/src/misc2.h index cafef9a3b3..791981688e 100644 --- a/src/misc2.h +++ b/src/misc2.h @@ -65,9 +65,6 @@ int after_pathsep(char_u *b, char_u *p); int same_directory(char_u *f1, char_u *f2); int vim_chdirfile(char_u *fname); int illegal_slash(char *name); -char_u *parse_shape_opt(int what); -int get_shape_idx(int mouse); -void update_mouseshape(int shape_idx); int vim_chdir(char_u *new_dir); int get_user_name(char_u *buf, int len); void sort_strings(char_u **files, int count); diff --git a/src/option.c b/src/option.c index e257186cf2..4fb498a0bc 100644 --- a/src/option.c +++ b/src/option.c @@ -56,6 +56,7 @@ #include "keymap.h" #include "crypt.h" #include "garray.h" +#include "cursor_shape.h" #include "move.h" #include "normal.h" #include "os_unix.h" diff --git a/src/structs.h b/src/structs.h index 3168e7d799..c678727b0a 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1724,54 +1724,6 @@ struct window_S { qf_info_T *w_llist_ref; }; -#ifdef CURSOR_SHAPE -/* - * struct to store values from 'guicursor' and 'mouseshape' - */ -/* Indexes in shape_table[] */ -#define SHAPE_IDX_N 0 /* Normal mode */ -#define SHAPE_IDX_V 1 /* Visual mode */ -#define SHAPE_IDX_I 2 /* Insert mode */ -#define SHAPE_IDX_R 3 /* Replace mode */ -#define SHAPE_IDX_C 4 /* Command line Normal mode */ -#define SHAPE_IDX_CI 5 /* Command line Insert mode */ -#define SHAPE_IDX_CR 6 /* Command line Replace mode */ -#define SHAPE_IDX_O 7 /* Operator-pending mode */ -#define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */ -#define SHAPE_IDX_CLINE 9 /* On command line */ -#define SHAPE_IDX_STATUS 10 /* A status line */ -#define SHAPE_IDX_SDRAG 11 /* dragging a status line */ -#define SHAPE_IDX_VSEP 12 /* A vertical separator line */ -#define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */ -#define SHAPE_IDX_MORE 14 /* Hit-return or More */ -#define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */ -#define SHAPE_IDX_SM 16 /* showing matching paren */ -#define SHAPE_IDX_COUNT 17 - -#define SHAPE_BLOCK 0 /* block cursor */ -#define SHAPE_HOR 1 /* horizontal bar cursor */ -#define SHAPE_VER 2 /* vertical bar cursor */ - -#define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */ -#define MSHAPE_HIDE 1 /* hide mouse pointer */ - -#define SHAPE_MOUSE 1 /* used for mouse pointer shape */ -#define SHAPE_CURSOR 2 /* used for text cursor shape */ - -typedef struct cursor_entry { - int shape; /* one of the SHAPE_ defines */ - int mshape; /* one of the MSHAPE defines */ - int percentage; /* percentage of cell for bar */ - long blinkwait; /* blinking, wait time before blinking starts */ - long blinkon; /* blinking, on time */ - long blinkoff; /* blinking, off time */ - int id; /* highlight group ID */ - int id_lm; /* highlight group ID for :lmap mode */ - char *name; /* mode name (fixed) */ - char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */ -} cursorentry_T; -#endif /* CURSOR_SHAPE */ - /* * Struct to save values in before executing autocommands for a buffer that is * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered. |