mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
parent
1684bec635
commit
3cac32e49c
@ -1,11 +1,10 @@
|
||||
#include "vim.h"
|
||||
#include "cursor_shape.h"
|
||||
#include "misc2.h"
|
||||
#include "ex_getln.h"
|
||||
#include "charset.h"
|
||||
#include "syntax.h"
|
||||
|
||||
#if defined(CURSOR_SHAPE) || defined(PROTO)
|
||||
|
||||
/*
|
||||
* Handling of cursor and mouse pointer shapes in various modes.
|
||||
*/
|
||||
@ -209,8 +208,6 @@ char_u *parse_shape_opt(int what)
|
||||
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.
|
||||
@ -242,6 +239,3 @@ int get_shape_idx(int mouse)
|
||||
}
|
||||
return SHAPE_IDX_N;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CURSOR_SHAPE */
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef NEOVIM_CURSOR_SHAPE_H
|
||||
#define NEOVIM_CURSOR_SHAPE_H
|
||||
|
||||
#ifdef CURSOR_SHAPE
|
||||
/*
|
||||
* struct to store values from 'guicursor' and 'mouseshape'
|
||||
*/
|
||||
@ -47,7 +46,6 @@ typedef struct cursor_entry {
|
||||
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);
|
||||
|
@ -547,9 +547,7 @@ edit (
|
||||
if (!p_im && did_restart_edit == 0)
|
||||
change_warning(i == 0 ? 0 : i + 1);
|
||||
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
do_digraph(-1); /* clear digraphs */
|
||||
|
||||
/*
|
||||
@ -7074,9 +7072,7 @@ ins_esc (
|
||||
changed_cline_bef_curs();
|
||||
|
||||
setmouse();
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When recording or for CTRL-O, need to display the new mode.
|
||||
@ -7190,9 +7186,7 @@ static void ins_insert(int replaceState)
|
||||
State = replaceState | (State & LANGMAP);
|
||||
AppendCharToRedobuff(K_INS);
|
||||
showmode();
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -10227,9 +10227,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
|
||||
"cryptv",
|
||||
"cscope",
|
||||
"cursorbind",
|
||||
#ifdef CURSOR_SHAPE
|
||||
"cursorshape",
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
"debug",
|
||||
#endif
|
||||
|
@ -294,9 +294,7 @@ getcmdline (
|
||||
#endif
|
||||
|
||||
setmouse();
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
|
||||
/* When inside an autocommand for writing "exiting" may be set and
|
||||
* terminal mode set to cooked. Need to set raw mode here then. */
|
||||
@ -866,9 +864,8 @@ getcmdline (
|
||||
beep_flush();
|
||||
else
|
||||
ccline.overstrike = !ccline.overstrike;
|
||||
#ifdef CURSOR_SHAPE
|
||||
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
goto cmdline_not_changed;
|
||||
|
||||
case Ctrl_HAT:
|
||||
@ -908,9 +905,7 @@ getcmdline (
|
||||
else
|
||||
set_imsearch_global();
|
||||
}
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
/* Show/unshow value of 'keymap' in status lines later. */
|
||||
status_redraw_curbuf();
|
||||
goto cmdline_not_changed;
|
||||
@ -1563,9 +1558,7 @@ returncmd:
|
||||
im_set_active(FALSE);
|
||||
#endif
|
||||
setmouse();
|
||||
#ifdef CURSOR_SHAPE
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
|
||||
{
|
||||
char_u *p = ccline.cmdbuff;
|
||||
@ -1967,8 +1960,6 @@ redraw:
|
||||
return (char_u *)line_ga.ga_data;
|
||||
}
|
||||
|
||||
# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \
|
||||
|| defined(FEAT_MOUSESHAPE) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE if ccline.overstrike is on.
|
||||
*/
|
||||
@ -1983,10 +1974,6 @@ int cmdline_at_end(void) {
|
||||
return ccline.cmdpos >= ccline.cmdlen;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Allocate a new command line buffer.
|
||||
* Assigns the new buffer to ccline.cmdbuff and ccline.cmdbufflen.
|
||||
|
12
src/normal.c
12
src/normal.c
@ -532,15 +532,11 @@ normal_cmd (
|
||||
* will terminate it. Finish_op tells us to finish the operation before
|
||||
* returning this time (unless the operation was cancelled).
|
||||
*/
|
||||
#ifdef CURSOR_SHAPE
|
||||
c = finish_op;
|
||||
#endif
|
||||
finish_op = (oap->op_type != OP_NOP);
|
||||
#ifdef CURSOR_SHAPE
|
||||
if (finish_op != c) {
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* When not finishing an operator and no register name typed, reset the
|
||||
* count. */
|
||||
@ -836,12 +832,10 @@ getcount:
|
||||
* Get a second or third character.
|
||||
*/
|
||||
if (cp != NULL) {
|
||||
#ifdef CURSOR_SHAPE
|
||||
if (repl) {
|
||||
State = REPLACE; /* pretend Replace mode */
|
||||
ui_cursor_shape(); /* show different cursor shape */
|
||||
}
|
||||
#endif
|
||||
if (lang && curbuf->b_p_iminsert == B_IMODE_LMAP) {
|
||||
/* Allow mappings defined with ":lmap". */
|
||||
--no_mapping;
|
||||
@ -875,9 +869,7 @@ getcount:
|
||||
}
|
||||
p_smd = save_smd;
|
||||
#endif
|
||||
#ifdef CURSOR_SHAPE
|
||||
State = NORMAL_BUSY;
|
||||
#endif
|
||||
need_flushbuf |= add_to_showcmd(*cp);
|
||||
|
||||
if (!lit) {
|
||||
@ -1107,17 +1099,13 @@ normal_end:
|
||||
msg_nowait = FALSE;
|
||||
|
||||
/* Reset finish_op, in case it was set */
|
||||
#ifdef CURSOR_SHAPE
|
||||
c = finish_op;
|
||||
#endif
|
||||
finish_op = FALSE;
|
||||
#ifdef CURSOR_SHAPE
|
||||
/* Redraw the cursor with another shape, if we were in Operator-pending
|
||||
* mode or did a replace command. */
|
||||
if (c || ca.cmdchar == 'r') {
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (oap->op_type == OP_NOP && oap->regname == 0
|
||||
&& ca.cmdchar != K_CURSORHOLD
|
||||
|
11
src/option.c
11
src/option.c
@ -828,16 +828,11 @@ static struct vimoption
|
||||
}
|
||||
SCRIPTID_INIT},
|
||||
{"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
||||
#ifdef CURSOR_SHAPE
|
||||
(char_u *)&p_guicursor, PV_NONE,
|
||||
{
|
||||
(char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block",
|
||||
(char_u *)0L
|
||||
}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)NULL, (char_u *)0L}
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
{"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
|
||||
(char_u *)NULL, PV_NONE,
|
||||
@ -2424,9 +2419,7 @@ void set_init_2(void) {
|
||||
options[idx].flags &= ~P_WAS_SET;
|
||||
}
|
||||
|
||||
#ifdef CURSOR_SHAPE
|
||||
parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
|
||||
#endif
|
||||
(void)parse_printoptions(); /* parse 'printoptions' default value */
|
||||
}
|
||||
|
||||
@ -4405,13 +4398,9 @@ did_set_string_option (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef CURSOR_SHAPE
|
||||
/* 'guicursor' */
|
||||
else if (varp == &p_guicursor)
|
||||
errmsg = parse_shape_opt(SHAPE_CURSOR);
|
||||
#endif
|
||||
|
||||
|
||||
else if (varp == &p_popt)
|
||||
errmsg = parse_printoptions();
|
||||
|
@ -397,9 +397,7 @@ EXTERN char_u *p_pfn; /* 'printfont' */
|
||||
EXTERN char_u *p_popt; /* 'printoptions' */
|
||||
EXTERN char_u *p_header; /* 'printheader' */
|
||||
EXTERN int p_prompt; /* 'prompt' */
|
||||
#ifdef CURSOR_SHAPE
|
||||
EXTERN char_u *p_guicursor; /* 'guicursor' */
|
||||
#endif
|
||||
EXTERN char_u *p_hf; /* 'helpfile' */
|
||||
EXTERN long p_hh; /* 'helpheight' */
|
||||
EXTERN char_u *p_hlg; /* 'helplang' */
|
||||
|
@ -2000,9 +2000,7 @@ showmatch (
|
||||
colnr_T vcol;
|
||||
long save_so;
|
||||
long save_siso;
|
||||
#ifdef CURSOR_SHAPE
|
||||
int save_state;
|
||||
#endif
|
||||
colnr_T save_dollar_vcol;
|
||||
char_u *p;
|
||||
|
||||
@ -2042,11 +2040,9 @@ showmatch (
|
||||
update_screen(VALID); /* show the new char first */
|
||||
|
||||
save_dollar_vcol = dollar_vcol;
|
||||
#ifdef CURSOR_SHAPE
|
||||
save_state = State;
|
||||
State = SHOWMATCH;
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
curwin->w_cursor = mpos; /* move to matching char */
|
||||
p_so = 0; /* don't use 'scrolloff' here */
|
||||
p_siso = 0; /* don't use 'sidescrolloff' here */
|
||||
@ -2070,10 +2066,8 @@ showmatch (
|
||||
curwin->w_cursor = save_cursor; /* restore cursor position */
|
||||
p_so = save_so;
|
||||
p_siso = save_siso;
|
||||
#ifdef CURSOR_SHAPE
|
||||
State = save_state;
|
||||
ui_cursor_shape(); /* may show different cursor shape */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2890,7 +2890,6 @@ void cursor_off(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CURSOR_SHAPE) || defined(PROTO)
|
||||
/*
|
||||
* Set cursor shape to match Insert mode.
|
||||
*/
|
||||
@ -2911,8 +2910,6 @@ void term_cursor_shape(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set scrolling region for window 'wp'.
|
||||
* The region starts 'off' lines from the start of the window.
|
||||
|
3
src/ui.c
3
src/ui.c
@ -579,7 +579,6 @@ void read_error_exit(void) {
|
||||
preserve_exit();
|
||||
}
|
||||
|
||||
#if defined(CURSOR_SHAPE) || defined(PROTO)
|
||||
/*
|
||||
* May update the shape of the cursor.
|
||||
*/
|
||||
@ -590,8 +589,6 @@ void ui_cursor_shape(void) {
|
||||
conceal_check_cursur_line();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(FEAT_RIGHTLEFT) \
|
||||
|| defined(FEAT_MBYTE) || defined(PROTO)
|
||||
/*
|
||||
|
@ -73,11 +73,7 @@ static char *(features[]) =
|
||||
"+cryptv",
|
||||
"+cscope",
|
||||
"+cursorbind",
|
||||
#ifdef CURSOR_SHAPE
|
||||
"+cursorshape",
|
||||
#else
|
||||
"-cursorshape",
|
||||
#endif
|
||||
"+dialog_con",
|
||||
"+diff",
|
||||
"+digraphs",
|
||||
|
Loading…
Reference in New Issue
Block a user