mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.0857: indent functionality is not separated
Problem: Ignore functionality is not separated. Solution: Move indent functionality into a new file. (Yegappan Lakshmanan, closes #3886)
This commit is contained in:
2
Filelist
2
Filelist
@@ -49,6 +49,7 @@ SRC_ALL = \
|
||||
src/gui_beval.c \
|
||||
src/hardcopy.c \
|
||||
src/hashtab.c \
|
||||
src/indent.c \
|
||||
src/json.c \
|
||||
src/json_test.c \
|
||||
src/kword_test.c \
|
||||
@@ -175,6 +176,7 @@ SRC_ALL = \
|
||||
src/proto/gui_beval.pro \
|
||||
src/proto/hardcopy.pro \
|
||||
src/proto/hashtab.pro \
|
||||
src/proto/indent.pro \
|
||||
src/proto/json.pro \
|
||||
src/proto/list.pro \
|
||||
src/proto/main.pro \
|
||||
|
@@ -548,6 +548,7 @@ vimobj = \
|
||||
$(OBJDIR)\getchar.obj \
|
||||
$(OBJDIR)\hardcopy.obj \
|
||||
$(OBJDIR)\hashtab.obj \
|
||||
$(OBJDIR)\indent.obj \
|
||||
$(OBJDIR)\json.obj \
|
||||
$(OBJDIR)\list.obj \
|
||||
$(OBJDIR)\main.obj \
|
||||
|
@@ -720,6 +720,7 @@ OBJ = \
|
||||
$(OUTDIR)/getchar.o \
|
||||
$(OUTDIR)/hardcopy.o \
|
||||
$(OUTDIR)/hashtab.o \
|
||||
$(OUTDIR)/indent.o \
|
||||
$(OUTDIR)/json.o \
|
||||
$(OUTDIR)/list.o \
|
||||
$(OUTDIR)/main.o \
|
||||
|
@@ -50,6 +50,7 @@ SRC = \
|
||||
getchar.c \
|
||||
hardcopy.c \
|
||||
hashtab.c \
|
||||
indent.c \
|
||||
json.c \
|
||||
list.c \
|
||||
main.c \
|
||||
@@ -108,6 +109,7 @@ OBJ = o/arabic.o \
|
||||
o/getchar.o \
|
||||
o/hardcopy.o \
|
||||
o/hashtab.o \
|
||||
o/indent.o \
|
||||
o/json.o \
|
||||
o/list.o \
|
||||
o/main.o \
|
||||
@@ -209,6 +211,8 @@ o/hardcopy.o: hardcopy.c $(SYMS)
|
||||
|
||||
o/hashtab.o: hashtab.c $(SYMS)
|
||||
|
||||
o/indent.o: indent.c $(SYMS)
|
||||
|
||||
o/json.o: json.c $(SYMS)
|
||||
|
||||
o/list.o: list.c $(SYMS)
|
||||
|
@@ -234,6 +234,7 @@ LINK32_OBJS= \
|
||||
"$(INTDIR)/getchar.obj" \
|
||||
"$(INTDIR)/hardcopy.obj" \
|
||||
"$(INTDIR)/hashtab.obj" \
|
||||
"$(INTDIR)/indent.obj" \
|
||||
"$(INTDIR)/json.obj" \
|
||||
"$(INTDIR)/list.obj" \
|
||||
"$(INTDIR)/main.obj" \
|
||||
@@ -434,6 +435,10 @@ SOURCE=.\hardcopy.c
|
||||
SOURCE=.\hashtab.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
#
|
||||
SOURCE=.\indent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gui.c
|
||||
|
||||
|
@@ -60,6 +60,7 @@ SRC = arabic.c \
|
||||
getchar.c \
|
||||
hardcopy.c \
|
||||
hashtab.c \
|
||||
indent.c \
|
||||
json.c \
|
||||
list.c \
|
||||
main.c \
|
||||
@@ -120,6 +121,7 @@ OBJ = obj/arabic.o \
|
||||
obj/getchar.o \
|
||||
obj/hardcopy.o \
|
||||
obj/hashtab.o \
|
||||
obj/indent.o \
|
||||
obj/json.o \
|
||||
obj/list.o \
|
||||
obj/main.o \
|
||||
@@ -178,6 +180,7 @@ PRO = proto/arabic.pro \
|
||||
proto/getchar.pro \
|
||||
proto/hardcopy.pro \
|
||||
proto/hashtab.pro \
|
||||
proto/indent.pro \
|
||||
proto/json.pro \
|
||||
proto/list.pro \
|
||||
proto/main.pro \
|
||||
@@ -329,6 +332,9 @@ obj/hardcopy.o: hardcopy.c
|
||||
obj/hashtab.o: hashtab.c
|
||||
$(CCSYM) $@ hashtab.c
|
||||
|
||||
obj/indent.o: indent.c
|
||||
$(CCSYM) $@ indent.c
|
||||
|
||||
obj/json.o: json.c
|
||||
$(CCSYM) $@ json.c
|
||||
|
||||
|
@@ -48,6 +48,7 @@ SRC = arabic.c \
|
||||
getchar.c \
|
||||
hardcopy.c \
|
||||
hashtab.c \
|
||||
indent.c \
|
||||
json.c \
|
||||
list.c \
|
||||
main.c \
|
||||
|
@@ -725,6 +725,7 @@ OBJ = \
|
||||
$(OUTDIR)\getchar.obj \
|
||||
$(OUTDIR)\hardcopy.obj \
|
||||
$(OUTDIR)\hashtab.obj \
|
||||
$(OUTDIR)\indent.obj \
|
||||
$(OUTDIR)\json.obj \
|
||||
$(OUTDIR)\list.obj \
|
||||
$(OUTDIR)\main.obj \
|
||||
@@ -1414,6 +1415,8 @@ $(OUTDIR)/hardcopy.obj: $(OUTDIR) hardcopy.c $(INCL)
|
||||
|
||||
$(OUTDIR)/hashtab.obj: $(OUTDIR) hashtab.c $(INCL)
|
||||
|
||||
$(OUTDIR)/indent.obj: $(OUTDIR) indent.c $(INCL)
|
||||
|
||||
$(OUTDIR)/gui.obj: $(OUTDIR) gui.c $(INCL) $(GUI_INCL)
|
||||
|
||||
$(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL)
|
||||
@@ -1645,6 +1648,7 @@ proto.h: \
|
||||
proto/getchar.pro \
|
||||
proto/hardcopy.pro \
|
||||
proto/hashtab.pro \
|
||||
proto/indent.pro \
|
||||
proto/json.pro \
|
||||
proto/list.pro \
|
||||
proto/main.pro \
|
||||
|
@@ -113,6 +113,7 @@ SRC = \
|
||||
getchar.c \
|
||||
hardcopy.c \
|
||||
hashtab.c \
|
||||
indent.c \
|
||||
json.c \
|
||||
list.c \
|
||||
main.c \
|
||||
@@ -172,6 +173,7 @@ OBJ = \
|
||||
getchar.o \
|
||||
hardcopy.o \
|
||||
hashtab.o \
|
||||
indent.o \
|
||||
json.o \
|
||||
list.o \
|
||||
main.o \
|
||||
@@ -231,6 +233,7 @@ PRO = \
|
||||
proto/getchar.pro \
|
||||
proto/hardcopy.pro \
|
||||
proto/hashtab.pro \
|
||||
proto/indent.pro \
|
||||
proto/json.pro \
|
||||
proto/list.pro \
|
||||
proto/main.pro \
|
||||
@@ -368,6 +371,8 @@ hardcopy.o: hardcopy.c
|
||||
proto/hardcopy.pro: hardcopy.c
|
||||
hashtab.o: hashtab.c
|
||||
proto/hashtab.pro: hashtab.c
|
||||
indent.o: indent.c
|
||||
proto/indent.pro: indent.c
|
||||
json.o: json.c
|
||||
proto/json.pro: json.c
|
||||
list.o: list.c
|
||||
|
@@ -314,7 +314,7 @@ ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \
|
||||
|
||||
SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c crypt.c crypt_zip.c dict.c diff.c digraph.c edit.c eval.c \
|
||||
evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c farsi.c fileio.c fold.c \
|
||||
getchar.c hardcopy.c hashtab.c json.c list.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \
|
||||
getchar.c hardcopy.c hashtab.c indent.c json.c list.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \
|
||||
misc2.c move.c normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c sha256.c sign.c \
|
||||
spell.c spellfile.c syntax.c tag.c term.c termlib.c textprop.c ui.c undo.c userfunc.c version.c screen.c \
|
||||
window.c os_unix.c os_vms.c pathdef.c \
|
||||
@@ -323,7 +323,7 @@ SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c crypt.c cr
|
||||
|
||||
OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj charset.obj crypt.obj crypt_zip.obj dict.obj diff.obj digraph.obj \
|
||||
edit.obj eval.obj evalfunc.obj ex_cmds.obj ex_cmds2.obj ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj \
|
||||
if_xcmdsrv.obj farsi.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj json.obj list.obj main.obj mark.obj \
|
||||
if_xcmdsrv.obj farsi.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj indent.obj json.obj list.obj main.obj mark.obj \
|
||||
menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \
|
||||
move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj quickfix.obj \
|
||||
regexp.obj search.obj sha256.obj sign.obj spell.obj spellfile.obj syntax.obj tag.obj term.obj termlib.obj textprop.obj \
|
||||
@@ -596,6 +596,7 @@ if_mzsch.obj : if_mzsch.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h option.h structs.h \
|
||||
regexp.h gui.h beval.h [.proto]gui_beval.pro ex_cmds.h proto.h \
|
||||
globals.h farsi.h arabic.h if_mzsch.h
|
||||
indent.obj : indent.c vim.h [.auto]config.h feature.h os_unix.h
|
||||
json.obj : json.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
||||
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \
|
||||
|
10
src/Makefile
10
src/Makefile
@@ -1599,6 +1599,7 @@ BASIC_SRC = \
|
||||
hashtab.c \
|
||||
if_cscope.c \
|
||||
if_xcmdsrv.c \
|
||||
indent.c \
|
||||
json.c \
|
||||
list.c \
|
||||
main.c \
|
||||
@@ -1712,6 +1713,7 @@ OBJ_COMMON = \
|
||||
$(HANGULIN_OBJ) \
|
||||
objects/if_cscope.o \
|
||||
objects/if_xcmdsrv.o \
|
||||
objects/indent.o \
|
||||
objects/list.o \
|
||||
objects/mark.o \
|
||||
objects/memline.o \
|
||||
@@ -1842,6 +1844,7 @@ PRO_AUTO = \
|
||||
if_python3.pro \
|
||||
if_ruby.pro \
|
||||
if_xcmdsrv.pro \
|
||||
indent.pro \
|
||||
json.pro \
|
||||
list.pro \
|
||||
main.pro \
|
||||
@@ -3093,6 +3096,9 @@ objects/if_ruby.o: if_ruby.c
|
||||
objects/if_tcl.o: if_tcl.c
|
||||
$(CCC_NF) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ if_tcl.c
|
||||
|
||||
objects/indent.o: indent.c
|
||||
$(CCC) -o $@ indent.c
|
||||
|
||||
objects/json.o: json.c
|
||||
$(CCC) -o $@ json.c
|
||||
|
||||
@@ -3490,6 +3496,10 @@ objects/if_xcmdsrv.o: if_xcmdsrv.c vim.h protodef.h auto/config.h feature.h \
|
||||
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h farsi.h arabic.h version.h
|
||||
objects/indent.o: indent.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||
os_mac.h ascii.h keymap.h term.h macros.h option.h beval.h structs.h \
|
||||
regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \
|
||||
arabic.h
|
||||
objects/json.o: json.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
|
331
src/edit.c
331
src/edit.c
@@ -216,9 +216,6 @@ static void mb_replace_pop_ins(int cc);
|
||||
static void replace_flush(void);
|
||||
static void replace_do_bs(int limit_col);
|
||||
static int del_char_after_col(int limit_col);
|
||||
#ifdef FEAT_CINDENT
|
||||
static int cindent_on(void);
|
||||
#endif
|
||||
static void ins_reg(void);
|
||||
static void ins_ctrl_g(void);
|
||||
static void ins_ctrl_hat(void);
|
||||
@@ -380,6 +377,7 @@ edit(
|
||||
ins_compl_clear(); /* clear stuff for CTRL-X mode */
|
||||
#endif
|
||||
|
||||
ch_log(NULL, "ENTERING Insert mode");
|
||||
/*
|
||||
* Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx".
|
||||
*/
|
||||
@@ -1050,6 +1048,7 @@ doESCkey:
|
||||
if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C)
|
||||
ins_apply_autocmds(EVENT_INSERTLEAVE);
|
||||
did_cursorhold = FALSE;
|
||||
ch_log(NULL, "LEAVING Insert mode");
|
||||
return (c == Ctrl_O);
|
||||
}
|
||||
continue;
|
||||
@@ -7923,332 +7922,6 @@ replace_do_bs(int limit_col)
|
||||
(void)del_char_after_col(limit_col);
|
||||
}
|
||||
|
||||
#ifdef FEAT_CINDENT
|
||||
/*
|
||||
* Return TRUE if C-indenting is on.
|
||||
*/
|
||||
static int
|
||||
cindent_on(void)
|
||||
{
|
||||
return (!p_paste && (curbuf->b_p_cin
|
||||
# ifdef FEAT_EVAL
|
||||
|| *curbuf->b_p_inde != NUL
|
||||
# endif
|
||||
));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(PROTO)
|
||||
/*
|
||||
* Re-indent the current line, based on the current contents of it and the
|
||||
* surrounding lines. Fixing the cursor position seems really easy -- I'm very
|
||||
* confused what all the part that handles Control-T is doing that I'm not.
|
||||
* "get_the_indent" should be get_c_indent, get_expr_indent or get_lisp_indent.
|
||||
*/
|
||||
|
||||
void
|
||||
fixthisline(int (*get_the_indent)(void))
|
||||
{
|
||||
int amount = get_the_indent();
|
||||
|
||||
if (amount >= 0)
|
||||
{
|
||||
change_indent(INDENT_SET, amount, FALSE, 0, TRUE);
|
||||
if (linewhite(curwin->w_cursor.lnum))
|
||||
did_ai = TRUE; /* delete the indent if the line stays empty */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fix_indent(void)
|
||||
{
|
||||
if (p_paste)
|
||||
return;
|
||||
# ifdef FEAT_LISP
|
||||
if (curbuf->b_p_lisp && curbuf->b_p_ai)
|
||||
fixthisline(get_lisp_indent);
|
||||
# endif
|
||||
# if defined(FEAT_LISP) && defined(FEAT_CINDENT)
|
||||
else
|
||||
# endif
|
||||
# ifdef FEAT_CINDENT
|
||||
if (cindent_on())
|
||||
do_c_expr_indent();
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CINDENT
|
||||
/*
|
||||
* return TRUE if 'cinkeys' contains the key "keytyped",
|
||||
* when == '*': Only if key is preceded with '*' (indent before insert)
|
||||
* when == '!': Only if key is preceded with '!' (don't insert)
|
||||
* when == ' ': Only if key is not preceded with '*'(indent afterwards)
|
||||
*
|
||||
* "keytyped" can have a few special values:
|
||||
* KEY_OPEN_FORW
|
||||
* KEY_OPEN_BACK
|
||||
* KEY_COMPLETE just finished completion.
|
||||
*
|
||||
* If line_is_empty is TRUE accept keys with '0' before them.
|
||||
*/
|
||||
int
|
||||
in_cinkeys(
|
||||
int keytyped,
|
||||
int when,
|
||||
int line_is_empty)
|
||||
{
|
||||
char_u *look;
|
||||
int try_match;
|
||||
int try_match_word;
|
||||
char_u *p;
|
||||
char_u *line;
|
||||
int icase;
|
||||
int i;
|
||||
|
||||
if (keytyped == NUL)
|
||||
/* Can happen with CTRL-Y and CTRL-E on a short line. */
|
||||
return FALSE;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
if (*curbuf->b_p_inde != NUL)
|
||||
look = curbuf->b_p_indk; /* 'indentexpr' set: use 'indentkeys' */
|
||||
else
|
||||
#endif
|
||||
look = curbuf->b_p_cink; /* 'indentexpr' empty: use 'cinkeys' */
|
||||
while (*look)
|
||||
{
|
||||
/*
|
||||
* Find out if we want to try a match with this key, depending on
|
||||
* 'when' and a '*' or '!' before the key.
|
||||
*/
|
||||
switch (when)
|
||||
{
|
||||
case '*': try_match = (*look == '*'); break;
|
||||
case '!': try_match = (*look == '!'); break;
|
||||
default: try_match = (*look != '*'); break;
|
||||
}
|
||||
if (*look == '*' || *look == '!')
|
||||
++look;
|
||||
|
||||
/*
|
||||
* If there is a '0', only accept a match if the line is empty.
|
||||
* But may still match when typing last char of a word.
|
||||
*/
|
||||
if (*look == '0')
|
||||
{
|
||||
try_match_word = try_match;
|
||||
if (!line_is_empty)
|
||||
try_match = FALSE;
|
||||
++look;
|
||||
}
|
||||
else
|
||||
try_match_word = FALSE;
|
||||
|
||||
/*
|
||||
* does it look like a control character?
|
||||
*/
|
||||
if (*look == '^'
|
||||
#ifdef EBCDIC
|
||||
&& (Ctrl_chr(look[1]) != 0)
|
||||
#else
|
||||
&& look[1] >= '?' && look[1] <= '_'
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (try_match && keytyped == Ctrl_chr(look[1]))
|
||||
return TRUE;
|
||||
look += 2;
|
||||
}
|
||||
/*
|
||||
* 'o' means "o" command, open forward.
|
||||
* 'O' means "O" command, open backward.
|
||||
*/
|
||||
else if (*look == 'o')
|
||||
{
|
||||
if (try_match && keytyped == KEY_OPEN_FORW)
|
||||
return TRUE;
|
||||
++look;
|
||||
}
|
||||
else if (*look == 'O')
|
||||
{
|
||||
if (try_match && keytyped == KEY_OPEN_BACK)
|
||||
return TRUE;
|
||||
++look;
|
||||
}
|
||||
|
||||
/*
|
||||
* 'e' means to check for "else" at start of line and just before the
|
||||
* cursor.
|
||||
*/
|
||||
else if (*look == 'e')
|
||||
{
|
||||
if (try_match && keytyped == 'e' && curwin->w_cursor.col >= 4)
|
||||
{
|
||||
p = ml_get_curline();
|
||||
if (skipwhite(p) == p + curwin->w_cursor.col - 4 &&
|
||||
STRNCMP(p + curwin->w_cursor.col - 4, "else", 4) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
++look;
|
||||
}
|
||||
|
||||
/*
|
||||
* ':' only causes an indent if it is at the end of a label or case
|
||||
* statement, or when it was before typing the ':' (to fix
|
||||
* class::method for C++).
|
||||
*/
|
||||
else if (*look == ':')
|
||||
{
|
||||
if (try_match && keytyped == ':')
|
||||
{
|
||||
p = ml_get_curline();
|
||||
if (cin_iscase(p, FALSE) || cin_isscopedecl(p) || cin_islabel())
|
||||
return TRUE;
|
||||
/* Need to get the line again after cin_islabel(). */
|
||||
p = ml_get_curline();
|
||||
if (curwin->w_cursor.col > 2
|
||||
&& p[curwin->w_cursor.col - 1] == ':'
|
||||
&& p[curwin->w_cursor.col - 2] == ':')
|
||||
{
|
||||
p[curwin->w_cursor.col - 1] = ' ';
|
||||
i = (cin_iscase(p, FALSE) || cin_isscopedecl(p)
|
||||
|| cin_islabel());
|
||||
p = ml_get_curline();
|
||||
p[curwin->w_cursor.col - 1] = ':';
|
||||
if (i)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
++look;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Is it a key in <>, maybe?
|
||||
*/
|
||||
else if (*look == '<')
|
||||
{
|
||||
if (try_match)
|
||||
{
|
||||
/*
|
||||
* make up some named keys <o>, <O>, <e>, <0>, <>>, <<>, <*>,
|
||||
* <:> and <!> so that people can re-indent on o, O, e, 0, <,
|
||||
* >, *, : and ! keys if they really really want to.
|
||||
*/
|
||||
if (vim_strchr((char_u *)"<>!*oOe0:", look[1]) != NULL
|
||||
&& keytyped == look[1])
|
||||
return TRUE;
|
||||
|
||||
if (keytyped == get_special_key_code(look + 1))
|
||||
return TRUE;
|
||||
}
|
||||
while (*look && *look != '>')
|
||||
look++;
|
||||
while (*look == '>')
|
||||
look++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is it a word: "=word"?
|
||||
*/
|
||||
else if (*look == '=' && look[1] != ',' && look[1] != NUL)
|
||||
{
|
||||
++look;
|
||||
if (*look == '~')
|
||||
{
|
||||
icase = TRUE;
|
||||
++look;
|
||||
}
|
||||
else
|
||||
icase = FALSE;
|
||||
p = vim_strchr(look, ',');
|
||||
if (p == NULL)
|
||||
p = look + STRLEN(look);
|
||||
if ((try_match || try_match_word)
|
||||
&& curwin->w_cursor.col >= (colnr_T)(p - look))
|
||||
{
|
||||
int match = FALSE;
|
||||
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
if (keytyped == KEY_COMPLETE)
|
||||
{
|
||||
char_u *s;
|
||||
|
||||
/* Just completed a word, check if it starts with "look".
|
||||
* search back for the start of a word. */
|
||||
line = ml_get_curline();
|
||||
if (has_mbyte)
|
||||
{
|
||||
char_u *n;
|
||||
|
||||
for (s = line + curwin->w_cursor.col; s > line; s = n)
|
||||
{
|
||||
n = mb_prevptr(line, s);
|
||||
if (!vim_iswordp(n))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
for (s = line + curwin->w_cursor.col; s > line; --s)
|
||||
if (!vim_iswordc(s[-1]))
|
||||
break;
|
||||
if (s + (p - look) <= line + curwin->w_cursor.col
|
||||
&& (icase
|
||||
? MB_STRNICMP(s, look, p - look)
|
||||
: STRNCMP(s, look, p - look)) == 0)
|
||||
match = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* TODO: multi-byte */
|
||||
if (keytyped == (int)p[-1] || (icase && keytyped < 256
|
||||
&& TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1])))
|
||||
{
|
||||
line = ml_get_cursor();
|
||||
if ((curwin->w_cursor.col == (colnr_T)(p - look)
|
||||
|| !vim_iswordc(line[-(p - look) - 1]))
|
||||
&& (icase
|
||||
? MB_STRNICMP(line - (p - look), look, p - look)
|
||||
: STRNCMP(line - (p - look), look, p - look))
|
||||
== 0)
|
||||
match = TRUE;
|
||||
}
|
||||
if (match && try_match_word && !try_match)
|
||||
{
|
||||
/* "0=word": Check if there are only blanks before the
|
||||
* word. */
|
||||
if (getwhitecols_curline() !=
|
||||
(int)(curwin->w_cursor.col - (p - look)))
|
||||
match = FALSE;
|
||||
}
|
||||
if (match)
|
||||
return TRUE;
|
||||
}
|
||||
look = p;
|
||||
}
|
||||
|
||||
/*
|
||||
* ok, it's a boring generic character.
|
||||
*/
|
||||
else
|
||||
{
|
||||
if (try_match && *look == keytyped)
|
||||
return TRUE;
|
||||
if (*look != NUL)
|
||||
++look;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip over ", ".
|
||||
*/
|
||||
look = skip_to_option_part(look);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* FEAT_CINDENT */
|
||||
|
||||
#if defined(FEAT_RIGHTLEFT) || defined(PROTO)
|
||||
/*
|
||||
* Map Hebrew keyboard when in hkmap mode.
|
||||
|
4683
src/indent.c
Normal file
4683
src/indent.c
Normal file
File diff suppressed because it is too large
Load Diff
4346
src/misc1.c
4346
src/misc1.c
File diff suppressed because it is too large
Load Diff
@@ -87,6 +87,7 @@ extern int _stricoll(char *a, char *b);
|
||||
# endif
|
||||
# include "hardcopy.pro"
|
||||
# include "hashtab.pro"
|
||||
# include "indent.pro"
|
||||
# include "json.pro"
|
||||
# include "list.pro"
|
||||
# include "blob.pro"
|
||||
|
@@ -38,9 +38,6 @@ char_u *get_last_insert(void);
|
||||
char_u *get_last_insert_save(void);
|
||||
void replace_push(int c);
|
||||
int replace_push_mb(char_u *p);
|
||||
void fixthisline(int (*get_the_indent)(void));
|
||||
void fix_indent(void);
|
||||
int in_cinkeys(int keytyped, int when, int line_is_empty);
|
||||
int hkmap(int c);
|
||||
int bracketed_paste(paste_mode_T mode, int drop, garray_T *gap);
|
||||
void ins_scroll(void);
|
||||
|
16
src/proto/indent.pro
Normal file
16
src/proto/indent.pro
Normal file
@@ -0,0 +1,16 @@
|
||||
/* indent.c */
|
||||
int cin_is_cinword(char_u *line);
|
||||
pos_T *find_start_comment(int ind_maxcomment);
|
||||
int cindent_on(void);
|
||||
int cin_islabel(void);
|
||||
int cin_iscase(char_u *s, int strict);
|
||||
int cin_isscopedecl(char_u *s);
|
||||
void parse_cino(buf_T *buf);
|
||||
int get_c_indent(void);
|
||||
int get_expr_indent(void);
|
||||
int in_cinkeys(int keytyped, int when, int line_is_empty);
|
||||
int get_lisp_indent(void);
|
||||
void do_c_expr_indent(void);
|
||||
void fixthisline(int (*get_the_indent)(void));
|
||||
void fix_indent(void);
|
||||
/* vim: set ft=c : */
|
@@ -83,15 +83,6 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep);
|
||||
char_u *concat_str(char_u *str1, char_u *str2);
|
||||
void add_pathsep(char_u *p);
|
||||
char_u *FullName_save(char_u *fname, int force);
|
||||
pos_T *find_start_comment(int ind_maxcomment);
|
||||
void do_c_expr_indent(void);
|
||||
int cin_islabel(void);
|
||||
int cin_iscase(char_u *s, int strict);
|
||||
int cin_isscopedecl(char_u *s);
|
||||
void parse_cino(buf_T *buf);
|
||||
int get_c_indent(void);
|
||||
int get_expr_indent(void);
|
||||
int get_lisp_indent(void);
|
||||
void prepare_to_exit(void);
|
||||
void preserve_exit(void);
|
||||
int vim_fexists(char_u *fname);
|
||||
|
@@ -783,6 +783,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
857,
|
||||
/**/
|
||||
856,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user