mirror of
https://github.com/zoriya/vim.git
synced 2025-12-13 02:36:16 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e971df39a5 | ||
|
|
aaaf57d8a9 | ||
|
|
1fb0d49803 | ||
|
|
a1891848d9 | ||
|
|
e353c402e6 | ||
|
|
698f8b207b | ||
|
|
25ea054458 | ||
|
|
6b40f30329 | ||
|
|
cbf20fbcd3 | ||
|
|
03ff9bcbc9 | ||
|
|
fd8983b09c | ||
|
|
7a073549a3 | ||
|
|
79da563cf9 | ||
|
|
e5f2a075e3 | ||
|
|
a2f28859bf | ||
|
|
23fa81d222 | ||
|
|
04e87b72c5 | ||
|
|
21d7c9b601 | ||
|
|
4e032e1b17 | ||
|
|
c7d9eacefa | ||
|
|
c10f0e7cb0 | ||
|
|
c386267ffe | ||
|
|
b245559fa9 |
@@ -1,4 +1,4 @@
|
|||||||
*term.txt* For Vim version 8.0. Last change: 2017 Jan 27
|
*term.txt* For Vim version 8.0. Last change: 2017 Feb 02
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -95,7 +95,12 @@ terminal when entering "raw" mode and 't_BD' when leaving "raw" mode. The
|
|||||||
terminal is then expected to put 't_PS' before pasted text and 't_PE' after
|
terminal is then expected to put 't_PS' before pasted text and 't_PE' after
|
||||||
pasted text. This way Vim can separate text that is pasted from characters
|
pasted text. This way Vim can separate text that is pasted from characters
|
||||||
that are typed. The pasted text is handled like when the middle mouse button
|
that are typed. The pasted text is handled like when the middle mouse button
|
||||||
is used.
|
is used, it is inserted literally and not interpreted as commands.
|
||||||
|
|
||||||
|
When the cursor is in the first column, the pasted text will be inserted
|
||||||
|
before it. Otherwise the pasted text is appended after the cursor position.
|
||||||
|
This means one cannot paste after the first column. Unfortunately Vim does
|
||||||
|
not have a way to tell where the mouse pointer was.
|
||||||
|
|
||||||
Note that in some situations Vim will not recognize the bracketed paste and
|
Note that in some situations Vim will not recognize the bracketed paste and
|
||||||
you will get the raw text. In other situations Vim will only get the first
|
you will get the raw text. In other situations Vim will only get the first
|
||||||
|
|||||||
@@ -2127,8 +2127,9 @@ test_arglist \
|
|||||||
test_fnameescape \
|
test_fnameescape \
|
||||||
test_fnamemodify \
|
test_fnamemodify \
|
||||||
test_fold \
|
test_fold \
|
||||||
test_glob2regpat \
|
test_ga \
|
||||||
test_gf \
|
test_gf \
|
||||||
|
test_glob2regpat \
|
||||||
test_gn \
|
test_gn \
|
||||||
test_goto \
|
test_goto \
|
||||||
test_gui \
|
test_gui \
|
||||||
|
|||||||
21
src/diff.c
21
src/diff.c
@@ -138,6 +138,23 @@ diff_buf_add(buf_T *buf)
|
|||||||
EMSGN(_("E96: Cannot diff more than %ld buffers"), DB_COUNT);
|
EMSGN(_("E96: Cannot diff more than %ld buffers"), DB_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove all buffers to make diffs for.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
diff_buf_clear(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < DB_COUNT; ++i)
|
||||||
|
if (curtab->tp_diffbuf[i] != NULL)
|
||||||
|
{
|
||||||
|
curtab->tp_diffbuf[i] = NULL;
|
||||||
|
curtab->tp_diff_invalid = TRUE;
|
||||||
|
diff_redraw(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find buffer "buf" in the list of diff buffers for the current tab page.
|
* Find buffer "buf" in the list of diff buffers for the current tab page.
|
||||||
* Return its index or DB_COUNT if not found.
|
* Return its index or DB_COUNT if not found.
|
||||||
@@ -1257,6 +1274,10 @@ ex_diffoff(exarg_T *eap)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Also remove hidden buffers from the list. */
|
||||||
|
if (eap->forceit)
|
||||||
|
diff_buf_clear();
|
||||||
|
|
||||||
#ifdef FEAT_SCROLLBIND
|
#ifdef FEAT_SCROLLBIND
|
||||||
/* Remove "hor" from from 'scrollopt' if there are no diff windows left. */
|
/* Remove "hor" from from 'scrollopt' if there are no diff windows left. */
|
||||||
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
|
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
|
||||||
|
|||||||
@@ -4357,9 +4357,16 @@ skip_range(
|
|||||||
{
|
{
|
||||||
unsigned delim;
|
unsigned delim;
|
||||||
|
|
||||||
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
|
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL)
|
||||||
{
|
{
|
||||||
if (*cmd == '\'')
|
if (*cmd == '\\')
|
||||||
|
{
|
||||||
|
if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&')
|
||||||
|
++cmd;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (*cmd == '\'')
|
||||||
{
|
{
|
||||||
if (*++cmd == NUL && ctx != NULL)
|
if (*++cmd == NUL && ctx != NULL)
|
||||||
*ctx = EXPAND_NOTHING;
|
*ctx = EXPAND_NOTHING;
|
||||||
@@ -11790,7 +11797,7 @@ ses_arglist(
|
|||||||
s = buf;
|
s = buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fputs("argadd ", fd) < 0
|
if (fputs("$argadd ", fd) < 0
|
||||||
|| ses_put_fname(fd, s, flagp) == FAIL
|
|| ses_put_fname(fd, s, flagp) == FAIL
|
||||||
|| put_eol(fd) == FAIL)
|
|| put_eol(fd) == FAIL)
|
||||||
{
|
{
|
||||||
|
|||||||
37
src/gui.c
37
src/gui.c
@@ -1459,6 +1459,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
again:
|
again:
|
||||||
|
new_pixel_width = 0;
|
||||||
|
new_pixel_height = 0;
|
||||||
busy = TRUE;
|
busy = TRUE;
|
||||||
|
|
||||||
/* Flush pending output before redrawing */
|
/* Flush pending output before redrawing */
|
||||||
@@ -1468,8 +1470,8 @@ again:
|
|||||||
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
|
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
|
||||||
|
|
||||||
gui_position_components(pixel_width);
|
gui_position_components(pixel_width);
|
||||||
|
|
||||||
gui_reset_scroll_region();
|
gui_reset_scroll_region();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At the "more" and ":confirm" prompt there is no redraw, put the cursor
|
* At the "more" and ":confirm" prompt there is no redraw, put the cursor
|
||||||
* at the last line here (why does it have to be one row too low?).
|
* at the last line here (why does it have to be one row too low?).
|
||||||
@@ -1491,17 +1493,22 @@ again:
|
|||||||
|
|
||||||
busy = FALSE;
|
busy = FALSE;
|
||||||
|
|
||||||
/*
|
/* We may have been called again while redrawing the screen.
|
||||||
* We could have been called again while redrawing the screen.
|
* Need to do it all again with the latest size then. But only if the size
|
||||||
* Need to do it all again with the latest size then.
|
* actually changed. */
|
||||||
*/
|
|
||||||
if (new_pixel_height)
|
if (new_pixel_height)
|
||||||
{
|
{
|
||||||
pixel_width = new_pixel_width;
|
if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
|
||||||
pixel_height = new_pixel_height;
|
{
|
||||||
new_pixel_width = 0;
|
new_pixel_width = 0;
|
||||||
new_pixel_height = 0;
|
new_pixel_height = 0;
|
||||||
goto again;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pixel_width = new_pixel_width;
|
||||||
|
pixel_height = new_pixel_height;
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1511,18 +1518,10 @@ again:
|
|||||||
void
|
void
|
||||||
gui_may_resize_shell(void)
|
gui_may_resize_shell(void)
|
||||||
{
|
{
|
||||||
int h, w;
|
|
||||||
|
|
||||||
if (new_pixel_height)
|
if (new_pixel_height)
|
||||||
{
|
|
||||||
/* careful: gui_resize_shell() may postpone the resize again if we
|
/* careful: gui_resize_shell() may postpone the resize again if we
|
||||||
* were called indirectly by it */
|
* were called indirectly by it */
|
||||||
w = new_pixel_width;
|
gui_resize_shell(new_pixel_width, new_pixel_height);
|
||||||
h = new_pixel_height;
|
|
||||||
new_pixel_width = 0;
|
|
||||||
new_pixel_height = 0;
|
|
||||||
gui_resize_shell(w, h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -1118,6 +1118,10 @@ main_loop(
|
|||||||
skip_redraw = FALSE;
|
skip_redraw = FALSE;
|
||||||
else if (do_redraw || stuff_empty())
|
else if (do_redraw || stuff_empty())
|
||||||
{
|
{
|
||||||
|
# ifdef FEAT_GUI
|
||||||
|
/* If ui_breakcheck() was used a resize may have been postponed. */
|
||||||
|
gui_may_resize_shell();
|
||||||
|
# endif
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
||||||
/* Trigger CursorMoved if the cursor moved. */
|
/* Trigger CursorMoved if the cursor moved. */
|
||||||
if (!finish_op && (
|
if (!finish_op && (
|
||||||
|
|||||||
@@ -3264,7 +3264,11 @@ change_warning(
|
|||||||
#endif
|
#endif
|
||||||
msg_clr_eos();
|
msg_clr_eos();
|
||||||
(void)msg_end();
|
(void)msg_end();
|
||||||
if (msg_silent == 0 && !silent_mode)
|
if (msg_silent == 0 && !silent_mode
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
|
&& time_for_testing != 1
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
out_flush();
|
out_flush();
|
||||||
ui_delay(1000L, TRUE); /* give the user time to think about it */
|
ui_delay(1000L, TRUE); /* give the user time to think about it */
|
||||||
|
|||||||
36
src/normal.c
36
src/normal.c
@@ -9050,6 +9050,34 @@ nv_edit(cmdarg_T *cap)
|
|||||||
/* drop the pasted text */
|
/* drop the pasted text */
|
||||||
bracketed_paste(PASTE_INSERT, TRUE, NULL);
|
bracketed_paste(PASTE_INSERT, TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
else if (cap->cmdchar == K_PS && VIsual_active)
|
||||||
|
{
|
||||||
|
pos_T old_pos = curwin->w_cursor;
|
||||||
|
pos_T old_visual = VIsual;
|
||||||
|
|
||||||
|
/* In Visual mode the selected text is deleted. */
|
||||||
|
if (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum)
|
||||||
|
{
|
||||||
|
shift_delete_registers();
|
||||||
|
cap->oap->regname = '1';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
cap->oap->regname = '-';
|
||||||
|
cap->cmdchar = 'd';
|
||||||
|
cap->nchar = NUL;
|
||||||
|
nv_operator(cap);
|
||||||
|
do_pending_operator(cap, 0, FALSE);
|
||||||
|
cap->cmdchar = K_PS;
|
||||||
|
|
||||||
|
/* When the last char in the line was deleted then append. Detect this
|
||||||
|
* by checking if the cursor moved to before the Visual area. */
|
||||||
|
if (*ml_get_cursor() != NUL && lt(curwin->w_cursor, old_pos)
|
||||||
|
&& lt(curwin->w_cursor, old_visual))
|
||||||
|
inc_cursor();
|
||||||
|
|
||||||
|
/* Insert to replace the deleted text with the pasted text. */
|
||||||
|
invoke_edit(cap, FALSE, cap->cmdchar, FALSE);
|
||||||
|
}
|
||||||
else if (!checkclearopq(cap->oap))
|
else if (!checkclearopq(cap->oap))
|
||||||
{
|
{
|
||||||
switch (cap->cmdchar)
|
switch (cap->cmdchar)
|
||||||
@@ -9079,8 +9107,14 @@ nv_edit(cmdarg_T *cap)
|
|||||||
beginline(BL_WHITE|BL_FIX);
|
beginline(BL_WHITE|BL_FIX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case K_PS:
|
||||||
|
/* Bracketed paste works like "a"ppend, unless the cursor is in
|
||||||
|
* the first column, then it inserts. */
|
||||||
|
if (curwin->w_cursor.col == 0)
|
||||||
|
break;
|
||||||
|
/*FALLTHROUGH*/
|
||||||
|
|
||||||
case 'a': /* "a"ppend is like "i"nsert on the next character. */
|
case 'a': /* "a"ppend is like "i"nsert on the next character. */
|
||||||
case K_PS: /* bracketed paste works like "a"ppend */
|
|
||||||
#ifdef FEAT_VIRTUALEDIT
|
#ifdef FEAT_VIRTUALEDIT
|
||||||
/* increment coladd when in virtual space, increment the
|
/* increment coladd when in virtual space, increment the
|
||||||
* column otherwise, also to append after an unprintable char */
|
* column otherwise, also to append after an unprintable char */
|
||||||
|
|||||||
26
src/ops.c
26
src/ops.c
@@ -1627,6 +1627,22 @@ adjust_clip_reg(int *rp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shift the delete registers: "9 is cleared, "8 becomes "9, etc.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
shift_delete_registers()
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
y_current = &y_regs[9];
|
||||||
|
free_yank_all(); /* free register nine */
|
||||||
|
for (n = 9; n > 1; --n)
|
||||||
|
y_regs[n] = y_regs[n - 1];
|
||||||
|
y_previous = y_current = &y_regs[1];
|
||||||
|
y_regs[1].y_array = NULL; /* set register one to empty */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle a delete operation.
|
* Handle a delete operation.
|
||||||
*
|
*
|
||||||
@@ -1739,12 +1755,7 @@ op_delete(oparg_T *oap)
|
|||||||
if (orig_regname != 0 || oap->motion_type == MLINE
|
if (orig_regname != 0 || oap->motion_type == MLINE
|
||||||
|| oap->line_count > 1 || oap->use_reg_one)
|
|| oap->line_count > 1 || oap->use_reg_one)
|
||||||
{
|
{
|
||||||
y_current = &y_regs[9];
|
shift_delete_registers();
|
||||||
free_yank_all(); /* free register nine */
|
|
||||||
for (n = 9; n > 1; --n)
|
|
||||||
y_regs[n] = y_regs[n - 1];
|
|
||||||
y_previous = y_current = &y_regs[1];
|
|
||||||
y_regs[1].y_array = NULL; /* set register one to empty */
|
|
||||||
if (op_yank(oap, TRUE, FALSE) == OK)
|
if (op_yank(oap, TRUE, FALSE) == OK)
|
||||||
did_yank = TRUE;
|
did_yank = TRUE;
|
||||||
}
|
}
|
||||||
@@ -2571,8 +2582,7 @@ op_insert(oparg_T *oap, long count1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
t1 = oap->start;
|
t1 = oap->start;
|
||||||
if (edit(NUL, FALSE, (linenr_T)count1))
|
(void)edit(NUL, FALSE, (linenr_T)count1);
|
||||||
return;
|
|
||||||
|
|
||||||
/* When a tab was inserted, and the characters in front of the tab
|
/* When a tab was inserted, and the characters in front of the tab
|
||||||
* have been converted to a tab as well, the column of the cursor
|
* have been converted to a tab as well, the column of the cursor
|
||||||
|
|||||||
61
src/option.c
61
src/option.c
@@ -4954,7 +4954,7 @@ do_set(
|
|||||||
if (flags & P_FLAGLIST)
|
if (flags & P_FLAGLIST)
|
||||||
{
|
{
|
||||||
/* Remove flags that appear twice. */
|
/* Remove flags that appear twice. */
|
||||||
for (s = newval; *s; ++s)
|
for (s = newval; *s;)
|
||||||
{
|
{
|
||||||
/* if options have P_FLAGLIST and
|
/* if options have P_FLAGLIST and
|
||||||
* P_ONECOMMA such as 'whichwrap' */
|
* P_ONECOMMA such as 'whichwrap' */
|
||||||
@@ -4966,7 +4966,7 @@ do_set(
|
|||||||
/* Remove the duplicated value and
|
/* Remove the duplicated value and
|
||||||
* the next comma. */
|
* the next comma. */
|
||||||
STRMOVE(s, s + 2);
|
STRMOVE(s, s + 2);
|
||||||
s -= 2;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -4975,9 +4975,10 @@ do_set(
|
|||||||
&& vim_strchr(s + 1, *s) != NULL)
|
&& vim_strchr(s + 1, *s) != NULL)
|
||||||
{
|
{
|
||||||
STRMOVE(s, s + 1);
|
STRMOVE(s, s + 1);
|
||||||
--s;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
++s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9197,7 +9198,35 @@ get_option_value(
|
|||||||
|
|
||||||
opt_idx = findoption(name);
|
opt_idx = findoption(name);
|
||||||
if (opt_idx < 0) /* unknown option */
|
if (opt_idx < 0) /* unknown option */
|
||||||
|
{
|
||||||
|
int key;
|
||||||
|
|
||||||
|
if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
|
||||||
|
&& (key = find_key_option(name)) != 0)
|
||||||
|
{
|
||||||
|
char_u key_name[2];
|
||||||
|
char_u *p;
|
||||||
|
|
||||||
|
if (key < 0)
|
||||||
|
{
|
||||||
|
key_name[0] = KEY2TERMCAP0(key);
|
||||||
|
key_name[1] = KEY2TERMCAP1(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key_name[0] = KS_KEY;
|
||||||
|
key_name[1] = (key & 0xff);
|
||||||
|
}
|
||||||
|
p = find_termcode(key_name);
|
||||||
|
if (p != NULL)
|
||||||
|
{
|
||||||
|
if (stringval != NULL)
|
||||||
|
*stringval = vim_strsave(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
return -3;
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
||||||
|
|
||||||
@@ -9455,7 +9484,33 @@ set_option_value(
|
|||||||
|
|
||||||
opt_idx = findoption(name);
|
opt_idx = findoption(name);
|
||||||
if (opt_idx < 0)
|
if (opt_idx < 0)
|
||||||
|
{
|
||||||
|
int key;
|
||||||
|
|
||||||
|
if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
|
||||||
|
&& (key = find_key_option(name)) != 0)
|
||||||
|
{
|
||||||
|
char_u key_name[2];
|
||||||
|
|
||||||
|
if (key < 0)
|
||||||
|
{
|
||||||
|
key_name[0] = KEY2TERMCAP0(key);
|
||||||
|
key_name[1] = KEY2TERMCAP1(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key_name[0] = KS_KEY;
|
||||||
|
key_name[1] = (key & 0xff);
|
||||||
|
}
|
||||||
|
add_termcode(key_name, string, FALSE);
|
||||||
|
if (full_screen)
|
||||||
|
ttest(FALSE);
|
||||||
|
redraw_all_later(CLEAR);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
EMSG2(_("E355: Unknown option: %s"), name);
|
EMSG2(_("E355: Unknown option: %s"), name);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags = options[opt_idx].flags;
|
flags = options[opt_idx].flags;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ int insert_reg(int regname, int literally);
|
|||||||
int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg);
|
int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg);
|
||||||
int cmdline_paste_reg(int regname, int literally, int remcr);
|
int cmdline_paste_reg(int regname, int literally, int remcr);
|
||||||
void adjust_clip_reg(int *rp);
|
void adjust_clip_reg(int *rp);
|
||||||
|
void shift_delete_registers(void);
|
||||||
int op_delete(oparg_T *oap);
|
int op_delete(oparg_T *oap);
|
||||||
int op_replace(oparg_T *oap, int c);
|
int op_replace(oparg_T *oap, int c);
|
||||||
void op_tilde(oparg_T *oap);
|
void op_tilde(oparg_T *oap);
|
||||||
|
|||||||
130
src/screen.c
130
src/screen.c
@@ -777,6 +777,57 @@ update_screen(int type)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FEAT_SIGNS) || defined(FEAT_GUI) || defined(FEAT_CONCEAL)
|
||||||
|
/*
|
||||||
|
* Prepare for updating one or more windows.
|
||||||
|
* Caller must check for "updating_screen" already set to avoid recursiveness.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
update_prepare(void)
|
||||||
|
{
|
||||||
|
cursor_off();
|
||||||
|
updating_screen = TRUE;
|
||||||
|
#ifdef FEAT_GUI
|
||||||
|
/* Remove the cursor before starting to do anything, because scrolling may
|
||||||
|
* make it difficult to redraw the text under it. */
|
||||||
|
if (gui.in_use)
|
||||||
|
gui_undraw_cursor();
|
||||||
|
#endif
|
||||||
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
|
start_search_hl();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Finish updating one or more windows.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
update_finish(void)
|
||||||
|
{
|
||||||
|
if (redraw_cmdline)
|
||||||
|
showmode();
|
||||||
|
|
||||||
|
# ifdef FEAT_SEARCH_EXTRA
|
||||||
|
end_search_hl();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
updating_screen = FALSE;
|
||||||
|
|
||||||
|
# ifdef FEAT_GUI
|
||||||
|
gui_may_resize_shell();
|
||||||
|
|
||||||
|
/* Redraw the cursor and update the scrollbars when all screen updating is
|
||||||
|
* done. */
|
||||||
|
if (gui.in_use)
|
||||||
|
{
|
||||||
|
out_flush(); /* required before updating the cursor */
|
||||||
|
gui_update_cursor(FALSE, FALSE);
|
||||||
|
gui_update_scrollbars(FALSE);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_CONCEAL) || defined(PROTO)
|
#if defined(FEAT_CONCEAL) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
||||||
@@ -826,17 +877,12 @@ update_single_line(win_T *wp, linenr_T lnum)
|
|||||||
/* Don't do anything if the screen structures are (not yet) valid. */
|
/* Don't do anything if the screen structures are (not yet) valid. */
|
||||||
if (!screen_valid(TRUE) || updating_screen)
|
if (!screen_valid(TRUE) || updating_screen)
|
||||||
return;
|
return;
|
||||||
updating_screen = TRUE;
|
|
||||||
|
|
||||||
if (lnum >= wp->w_topline && lnum < wp->w_botline
|
if (lnum >= wp->w_topline && lnum < wp->w_botline
|
||||||
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
|
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_GUI
|
update_prepare();
|
||||||
/* Remove the cursor before starting to do anything, because scrolling
|
|
||||||
* may make it difficult to redraw the text under it. */
|
|
||||||
if (gui.in_use)
|
|
||||||
gui_undraw_cursor();
|
|
||||||
# endif
|
|
||||||
row = 0;
|
row = 0;
|
||||||
for (j = 0; j < wp->w_lines_valid; ++j)
|
for (j = 0; j < wp->w_lines_valid; ++j)
|
||||||
{
|
{
|
||||||
@@ -856,68 +902,10 @@ update_single_line(win_T *wp, linenr_T lnum)
|
|||||||
}
|
}
|
||||||
row += wp->w_lines[j].wl_size;
|
row += wp->w_lines[j].wl_size;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_GUI
|
|
||||||
/* Redraw the cursor */
|
update_finish();
|
||||||
if (gui.in_use)
|
|
||||||
{
|
|
||||||
out_flush(); /* required before updating the cursor */
|
|
||||||
gui_update_cursor(FALSE, FALSE);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
need_cursor_line_redraw = FALSE;
|
need_cursor_line_redraw = FALSE;
|
||||||
updating_screen = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_SIGNS) || defined(FEAT_GUI)
|
|
||||||
/*
|
|
||||||
* Prepare for updating one or more windows.
|
|
||||||
* Caller must check for "updating_screen" already set to avoid recursiveness.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
update_prepare(void)
|
|
||||||
{
|
|
||||||
cursor_off();
|
|
||||||
updating_screen = TRUE;
|
|
||||||
#ifdef FEAT_GUI
|
|
||||||
/* Remove the cursor before starting to do anything, because scrolling may
|
|
||||||
* make it difficult to redraw the text under it. */
|
|
||||||
if (gui.in_use)
|
|
||||||
gui_undraw_cursor();
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
|
||||||
start_search_hl();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Finish updating one or more windows.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
update_finish(void)
|
|
||||||
{
|
|
||||||
if (redraw_cmdline)
|
|
||||||
showmode();
|
|
||||||
|
|
||||||
# ifdef FEAT_SEARCH_EXTRA
|
|
||||||
end_search_hl();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
updating_screen = FALSE;
|
|
||||||
|
|
||||||
# ifdef FEAT_GUI
|
|
||||||
gui_may_resize_shell();
|
|
||||||
|
|
||||||
/* Redraw the cursor and update the scrollbars when all screen updating is
|
|
||||||
* done. */
|
|
||||||
if (gui.in_use)
|
|
||||||
{
|
|
||||||
out_flush(); /* required before updating the cursor */
|
|
||||||
gui_update_cursor(FALSE, FALSE);
|
|
||||||
gui_update_scrollbars(FALSE);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2915,7 +2903,7 @@ win_line(
|
|||||||
int endrow,
|
int endrow,
|
||||||
int nochange UNUSED) /* not updating for changed text */
|
int nochange UNUSED) /* not updating for changed text */
|
||||||
{
|
{
|
||||||
int col; /* visual column on screen */
|
int col = 0; /* visual column on screen */
|
||||||
unsigned off; /* offset in ScreenLines/ScreenAttrs */
|
unsigned off; /* offset in ScreenLines/ScreenAttrs */
|
||||||
int c = 0; /* init for GCC */
|
int c = 0; /* init for GCC */
|
||||||
long vcol = 0; /* virtual column (for tabs) */
|
long vcol = 0; /* virtual column (for tabs) */
|
||||||
@@ -3441,7 +3429,11 @@ win_line(
|
|||||||
#else
|
#else
|
||||||
--ptr;
|
--ptr;
|
||||||
#endif
|
#endif
|
||||||
n_skip = v - vcol;
|
#ifdef FEAT_MBYTE
|
||||||
|
/* character fits on the screen, don't need to skip it */
|
||||||
|
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
|
||||||
|
#endif
|
||||||
|
n_skip = v - vcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1337,6 +1337,7 @@ typedef struct
|
|||||||
int uf_varargs; /* variable nr of arguments */
|
int uf_varargs; /* variable nr of arguments */
|
||||||
int uf_flags;
|
int uf_flags;
|
||||||
int uf_calls; /* nr of active calls */
|
int uf_calls; /* nr of active calls */
|
||||||
|
int uf_cleared; /* func_clear() was already called */
|
||||||
garray_T uf_args; /* arguments */
|
garray_T uf_args; /* arguments */
|
||||||
garray_T uf_lines; /* function lines */
|
garray_T uf_lines; /* function lines */
|
||||||
#ifdef FEAT_PROFILE
|
#ifdef FEAT_PROFILE
|
||||||
|
|||||||
@@ -88,6 +88,14 @@ endfunc
|
|||||||
|
|
||||||
function RunTheTest(test)
|
function RunTheTest(test)
|
||||||
echo 'Executing ' . a:test
|
echo 'Executing ' . a:test
|
||||||
|
|
||||||
|
" Avoid stopping at the "hit enter" prompt
|
||||||
|
set nomore
|
||||||
|
|
||||||
|
" Avoid a three second wait when a message is about to be overwritten by the
|
||||||
|
" mode message.
|
||||||
|
set noshowmode
|
||||||
|
|
||||||
if exists("*SetUp")
|
if exists("*SetUp")
|
||||||
try
|
try
|
||||||
call SetUp()
|
call SetUp()
|
||||||
@@ -153,16 +161,16 @@ endif
|
|||||||
|
|
||||||
" Names of flaky tests.
|
" Names of flaky tests.
|
||||||
let s:flaky = [
|
let s:flaky = [
|
||||||
\ 'Test_reltime()',
|
|
||||||
\ 'Test_nb_basic()',
|
|
||||||
\ 'Test_communicate()',
|
|
||||||
\ 'Test_close_and_exit_cb()',
|
\ 'Test_close_and_exit_cb()',
|
||||||
|
\ 'Test_collapse_buffers()',
|
||||||
|
\ 'Test_communicate()',
|
||||||
|
\ 'Test_nb_basic()',
|
||||||
\ 'Test_pipe_through_sort_all()',
|
\ 'Test_pipe_through_sort_all()',
|
||||||
\ 'Test_pipe_through_sort_some()'
|
\ 'Test_pipe_through_sort_some()',
|
||||||
|
\ 'Test_reltime()',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
" Locate Test_ functions and execute them.
|
" Locate Test_ functions and execute them.
|
||||||
set nomore
|
|
||||||
redir @q
|
redir @q
|
||||||
silent function /^Test_
|
silent function /^Test_
|
||||||
redir END
|
redir END
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ source test_float_func.vim
|
|||||||
source test_fnamemodify.vim
|
source test_fnamemodify.vim
|
||||||
source test_functions.vim
|
source test_functions.vim
|
||||||
source test_glob2regpat.vim
|
source test_glob2regpat.vim
|
||||||
|
source test_ga.vim
|
||||||
source test_goto.vim
|
source test_goto.vim
|
||||||
source test_help_tagjump.vim
|
source test_help_tagjump.vim
|
||||||
source test_join.vim
|
source test_join.vim
|
||||||
|
|||||||
@@ -7,3 +7,25 @@ func Test_no_type_checking()
|
|||||||
let v = 3.4
|
let v = 3.4
|
||||||
let v = 'hello'
|
let v = 'hello'
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_let_termcap()
|
||||||
|
" Terminal code
|
||||||
|
let old_t_te = &t_te
|
||||||
|
let &t_te = "\<Esc>[yes;"
|
||||||
|
call assert_match('t_te.*^[[yes;', execute("set termcap"))
|
||||||
|
let &t_te = old_t_te
|
||||||
|
|
||||||
|
if !has('gui_running')
|
||||||
|
" Key code
|
||||||
|
let old_t_k1 = &t_k1
|
||||||
|
let &t_k1 = "that"
|
||||||
|
call assert_match('t_k1.*that', execute("set termcap"))
|
||||||
|
let &t_k1 = old_t_k1
|
||||||
|
endif
|
||||||
|
|
||||||
|
call assert_fails('let x = &t_xx', 'E15')
|
||||||
|
let &t_xx = "yes"
|
||||||
|
call assert_equal("yes", &t_xx)
|
||||||
|
let &t_xx = ""
|
||||||
|
call assert_fails('let x = &t_xx', 'E15')
|
||||||
|
endfunc
|
||||||
|
|||||||
@@ -306,3 +306,28 @@ func Test_cmdline_complete_wildoptions()
|
|||||||
call assert_equal(a, b)
|
call assert_equal(a, b)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" using a leading backslash here
|
||||||
|
set cpo+=C
|
||||||
|
|
||||||
|
func Test_cmdline_search_range()
|
||||||
|
new
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd'])
|
||||||
|
/d
|
||||||
|
1,\/s/b/B/
|
||||||
|
call assert_equal('B', getline(2))
|
||||||
|
|
||||||
|
/a
|
||||||
|
$
|
||||||
|
\?,4s/c/C/
|
||||||
|
call assert_equal('C', getline(3))
|
||||||
|
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd'])
|
||||||
|
%s/c/c/
|
||||||
|
1,\&s/b/B/
|
||||||
|
call assert_equal('B', getline(2))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
set cpo&
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ func Test_diffoff()
|
|||||||
call setline(1, ['One', '', 'Two', 'Three'])
|
call setline(1, ['One', '', 'Two', 'Three'])
|
||||||
diffthis
|
diffthis
|
||||||
redraw
|
redraw
|
||||||
|
call assert_notequal(normattr, screenattr(1, 1))
|
||||||
diffoff!
|
diffoff!
|
||||||
redraw
|
redraw
|
||||||
call assert_equal(normattr, screenattr(1, 1))
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
@@ -219,6 +220,42 @@ func Test_diffoff()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_diffoff_hidden()
|
||||||
|
set diffopt=filler,foldcolumn:0
|
||||||
|
e! one
|
||||||
|
call setline(1, ['Two', 'Three'])
|
||||||
|
let normattr = screenattr(1, 1)
|
||||||
|
diffthis
|
||||||
|
botright vert new two
|
||||||
|
call setline(1, ['One', 'Four'])
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
call assert_notequal(normattr, screenattr(1, 1))
|
||||||
|
set hidden
|
||||||
|
close
|
||||||
|
redraw
|
||||||
|
" diffing with hidden buffer two
|
||||||
|
call assert_notequal(normattr, screenattr(1, 1))
|
||||||
|
diffoff
|
||||||
|
redraw
|
||||||
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
" still diffing with hidden buffer two
|
||||||
|
call assert_notequal(normattr, screenattr(1, 1))
|
||||||
|
diffoff!
|
||||||
|
redraw
|
||||||
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
" no longer diffing with hidden buffer two
|
||||||
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
bwipe!
|
||||||
|
set hidden& diffopt&
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_setting_cursor()
|
func Test_setting_cursor()
|
||||||
new Xtest1
|
new Xtest1
|
||||||
put =range(1,90)
|
put =range(1,90)
|
||||||
|
|||||||
@@ -320,39 +320,73 @@ func! Test_mode()
|
|||||||
normal! 3G
|
normal! 3G
|
||||||
exe "normal i\<F2>\<Esc>"
|
exe "normal i\<F2>\<Esc>"
|
||||||
call assert_equal('i-i', g:current_modes)
|
call assert_equal('i-i', g:current_modes)
|
||||||
|
" i_CTRL-P: Multiple matches
|
||||||
exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
|
exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-P: Single match
|
||||||
exe "normal iBro\<C-P>\<F2>\<Esc>u"
|
exe "normal iBro\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X
|
||||||
exe "normal iBa\<C-X>\<F2>\<Esc>u"
|
exe "normal iBa\<C-X>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ix', g:current_modes)
|
call assert_equal('i-ix', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-P: Multiple matches
|
||||||
exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-P: Single match
|
||||||
exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-P + CTRL-P: Single match
|
||||||
exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-L: Multiple matches
|
||||||
|
exe "normal i\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-L: Single match
|
||||||
|
exe "normal iBlu\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-P: No match
|
||||||
exe "normal iCom\<C-P>\<F2>\<Esc>u"
|
exe "normal iCom\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-P: No match
|
||||||
exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('i-ic', g:current_modes)
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
" i_CTRL-X CTRL-L: No match
|
||||||
|
exe "normal iabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('i-ic', g:current_modes)
|
||||||
|
|
||||||
|
" R_CTRL-P: Multiple matches
|
||||||
exe "normal RBa\<C-P>\<F2>\<Esc>u"
|
exe "normal RBa\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-P: Single match
|
||||||
exe "normal RBro\<C-P>\<F2>\<Esc>u"
|
exe "normal RBro\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X
|
||||||
exe "normal RBa\<C-X>\<F2>\<Esc>u"
|
exe "normal RBa\<C-X>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rx', g:current_modes)
|
call assert_equal('R-Rx', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-P: Multiple matches
|
||||||
exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-P: Single match
|
||||||
exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-P + CTRL-P: Single match
|
||||||
exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-L: Multiple matches
|
||||||
|
exe "normal R\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-L: Single match
|
||||||
|
exe "normal RBlu\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-P: No match
|
||||||
exe "normal RCom\<C-P>\<F2>\<Esc>u"
|
exe "normal RCom\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-P: No match
|
||||||
exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
" R_CTRL-X CTRL-L: No match
|
||||||
|
exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
|
||||||
call assert_equal('n', mode(0))
|
call assert_equal('n', mode(0))
|
||||||
call assert_equal('n', mode(1))
|
call assert_equal('n', mode(1))
|
||||||
|
|||||||
37
src/testdir/test_ga.vim
Normal file
37
src/testdir/test_ga.vim
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
" Test ga normal command, and :ascii Ex command.
|
||||||
|
func Do_ga(c)
|
||||||
|
call setline(1, a:c)
|
||||||
|
let l:a = execute("norm 1goga")
|
||||||
|
let l:b = execute("ascii")
|
||||||
|
call assert_equal(l:a, l:b)
|
||||||
|
return l:a
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_ga_command()
|
||||||
|
new
|
||||||
|
set display=uhex
|
||||||
|
call assert_equal("\nNUL", Do_ga(''))
|
||||||
|
call assert_equal("\n<<01>> 1, Hex 01, Octal 001", Do_ga("\x01"))
|
||||||
|
call assert_equal("\n<<09>> 9, Hex 09, Octal 011", Do_ga("\t"))
|
||||||
|
|
||||||
|
set display=
|
||||||
|
call assert_equal("\nNUL", Do_ga(''))
|
||||||
|
call assert_equal("\n<^A> 1, Hex 01, Octal 001", Do_ga("\x01"))
|
||||||
|
call assert_equal("\n<^I> 9, Hex 09, Octal 011", Do_ga("\t"))
|
||||||
|
|
||||||
|
call assert_equal("\n<e> 101, Hex 65, Octal 145", Do_ga('e'))
|
||||||
|
|
||||||
|
if !has('multi_byte')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Test a few multi-bytes characters.
|
||||||
|
call assert_equal("\n<é> 233, Hex 00e9, Octal 351", Do_ga('é'))
|
||||||
|
call assert_equal("\n<ẻ> 7867, Hex 1ebb, Octal 17273", Do_ga('ẻ'))
|
||||||
|
|
||||||
|
" Test with combining characters.
|
||||||
|
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301"))
|
||||||
|
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331"))
|
||||||
|
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461 < ̸> 824, Hex 0338, Octal 1470", Do_ga("e\u0301\u0331\u0338"))
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
@@ -110,4 +110,16 @@ func Test_mksession_winheight()
|
|||||||
call delete('Xtest_mks.out')
|
call delete('Xtest_mks.out')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_arglist()
|
||||||
|
argdel *
|
||||||
|
next file1 file2 file3 file4
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
source Xtest_mks.out
|
||||||
|
call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
|
||||||
|
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
argdel *
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -2193,6 +2193,8 @@ func! Test_normal51_FileChangedRO()
|
|||||||
if !has("autocmd")
|
if !has("autocmd")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
" Don't sleep after the warning message.
|
||||||
|
call test_settime(1)
|
||||||
call writefile(['foo'], 'Xreadonly.log')
|
call writefile(['foo'], 'Xreadonly.log')
|
||||||
new Xreadonly.log
|
new Xreadonly.log
|
||||||
setl ro
|
setl ro
|
||||||
@@ -2202,6 +2204,7 @@ func! Test_normal51_FileChangedRO()
|
|||||||
call assert_equal('Xreadonly.log', bufname(''))
|
call assert_equal('Xreadonly.log', bufname(''))
|
||||||
|
|
||||||
" cleanup
|
" cleanup
|
||||||
|
call test_settime(0)
|
||||||
bw!
|
bw!
|
||||||
call delete("Xreadonly.log")
|
call delete("Xreadonly.log")
|
||||||
endfunc
|
endfunc
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ function! Test_whichwrap()
|
|||||||
set whichwrap+=h,l
|
set whichwrap+=h,l
|
||||||
call assert_equal('b,s,h,l', &whichwrap)
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -128,4 +134,95 @@ endfunc
|
|||||||
|
|
||||||
func Test_thesaurus()
|
func Test_thesaurus()
|
||||||
call Check_dir_option('thesaurus')
|
call Check_dir_option('thesaurus')
|
||||||
|
endfun
|
||||||
|
|
||||||
|
func Test_set_completion()
|
||||||
|
call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)
|
||||||
|
|
||||||
|
" Expand boolan options. When doing :set no<Tab>
|
||||||
|
" vim displays the options names without "no" but completion uses "no...".
|
||||||
|
call feedkeys(":set nodi\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set nodiff digraph', @:)
|
||||||
|
|
||||||
|
call feedkeys(":set invdi\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set invdiff digraph', @:)
|
||||||
|
|
||||||
|
" Expand abbreviation of options.
|
||||||
|
call feedkeys(":set ts\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set tabstop thesaurus ttyscroll', @:)
|
||||||
|
|
||||||
|
" Expand current value
|
||||||
|
call feedkeys(":set fileencodings=\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set fileencodings=ucs-bom,utf-8,default,latin1', @:)
|
||||||
|
|
||||||
|
call feedkeys(":set fileencodings:\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:)
|
||||||
|
|
||||||
|
" Expand key codes.
|
||||||
|
call feedkeys(":set <H\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set <Help> <Home>', @:)
|
||||||
|
|
||||||
|
" Expand terminal options.
|
||||||
|
call feedkeys(":set t_A\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set t_AB t_AF t_AL', @:)
|
||||||
|
|
||||||
|
" Expand directories.
|
||||||
|
call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match(' ./samples/ ', @:)
|
||||||
|
call assert_notmatch(' ./small.vim ', @:)
|
||||||
|
|
||||||
|
" Expand files and directories.
|
||||||
|
call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match(' ./samples/.* ./small.vim', @:)
|
||||||
|
|
||||||
|
call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_set_errors()
|
||||||
|
call assert_fails('set scroll=-1', 'E49:')
|
||||||
|
call assert_fails('set backupcopy=', 'E474:')
|
||||||
|
call assert_fails('set regexpengine=3', 'E474:')
|
||||||
|
call assert_fails('set history=10001', 'E474:')
|
||||||
|
call assert_fails('set numberwidth=11', 'E474:')
|
||||||
|
call assert_fails('set colorcolumn=-a')
|
||||||
|
call assert_fails('set colorcolumn=a')
|
||||||
|
call assert_fails('set colorcolumn=1,')
|
||||||
|
call assert_fails('set cmdheight=-1', 'E487:')
|
||||||
|
call assert_fails('set cmdwinheight=-1', 'E487:')
|
||||||
|
if has('conceal')
|
||||||
|
call assert_fails('set conceallevel=-1', 'E487:')
|
||||||
|
call assert_fails('set conceallevel=4', 'E474:')
|
||||||
|
endif
|
||||||
|
call assert_fails('set helpheight=-1', 'E487:')
|
||||||
|
call assert_fails('set history=-1', 'E487:')
|
||||||
|
call assert_fails('set report=-1', 'E487:')
|
||||||
|
call assert_fails('set shiftwidth=-1', 'E487:')
|
||||||
|
call assert_fails('set sidescroll=-1', 'E487:')
|
||||||
|
call assert_fails('set tabstop=-1', 'E487:')
|
||||||
|
call assert_fails('set textwidth=-1', 'E487:')
|
||||||
|
call assert_fails('set timeoutlen=-1', 'E487:')
|
||||||
|
call assert_fails('set updatecount=-1', 'E487:')
|
||||||
|
call assert_fails('set updatetime=-1', 'E487:')
|
||||||
|
call assert_fails('set winheight=-1', 'E487:')
|
||||||
|
call assert_fails('set tabstop!', 'E488:')
|
||||||
|
call assert_fails('set xxx', 'E518:')
|
||||||
|
call assert_fails('set beautify?', 'E519:')
|
||||||
|
call assert_fails('set undolevels=x', 'E521:')
|
||||||
|
call assert_fails('set tabstop=', 'E521:')
|
||||||
|
call assert_fails('set comments=-', 'E524:')
|
||||||
|
call assert_fails('set comments=a', 'E525:')
|
||||||
|
call assert_fails('set foldmarker=x', 'E536:')
|
||||||
|
call assert_fails('set commentstring=x', 'E537:')
|
||||||
|
call assert_fails('set complete=x', 'E539:')
|
||||||
|
call assert_fails('set statusline=%{', 'E540:')
|
||||||
|
call assert_fails('set statusline=' . repeat("%p", 81), 'E541:')
|
||||||
|
call assert_fails('set statusline=%(', 'E542:')
|
||||||
|
call assert_fails('set guicursor=x', 'E545:')
|
||||||
|
call assert_fails('set backupext=~ patchmode=~', 'E589:')
|
||||||
|
call assert_fails('set winminheight=10 winheight=9', 'E591:')
|
||||||
|
call assert_fails('set winminwidth=10 winwidth=9', 'E592:')
|
||||||
|
call assert_fails("set showbreak=\x01", 'E595:')
|
||||||
|
call assert_fails('set t_foo=', 'E846:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|||||||
@@ -8,18 +8,36 @@ set term=xterm
|
|||||||
|
|
||||||
func Test_paste_normal_mode()
|
func Test_paste_normal_mode()
|
||||||
new
|
new
|
||||||
|
" In first column text is inserted
|
||||||
call setline(1, ['a', 'b', 'c'])
|
call setline(1, ['a', 'b', 'c'])
|
||||||
2
|
call cursor(2, 1)
|
||||||
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
|
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
|
||||||
call assert_equal('bfoo', getline(2))
|
call assert_equal('foo', getline(2))
|
||||||
call assert_equal('bar', getline(3))
|
call assert_equal('barb', getline(3))
|
||||||
call assert_equal('c', getline(4))
|
call assert_equal('c', getline(4))
|
||||||
|
|
||||||
|
" When repeating text is appended
|
||||||
normal .
|
normal .
|
||||||
call assert_equal('barfoo', getline(3))
|
call assert_equal('barfoo', getline(3))
|
||||||
call assert_equal('bar', getline(4))
|
call assert_equal('barb', getline(4))
|
||||||
call assert_equal('c', getline(5))
|
call assert_equal('c', getline(5))
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
|
" In second column text is appended
|
||||||
|
call setline(1, ['a', 'bbb', 'c'])
|
||||||
|
call cursor(2, 2)
|
||||||
|
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('bbfoo', getline(2))
|
||||||
|
call assert_equal('barb', getline(3))
|
||||||
|
call assert_equal('c', getline(4))
|
||||||
|
|
||||||
|
" In last column text is appended
|
||||||
|
call setline(1, ['a', 'bbb', 'c'])
|
||||||
|
call cursor(2, 3)
|
||||||
|
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('bbbfoo', getline(2))
|
||||||
|
call assert_equal('bar', getline(3))
|
||||||
|
call assert_equal('c', getline(4))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_paste_insert_mode()
|
func Test_paste_insert_mode()
|
||||||
@@ -52,3 +70,30 @@ func Test_paste_cmdline()
|
|||||||
call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
|
call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
|
||||||
call assert_equal("\"afoo\<CR>barb", getreg(':'))
|
call assert_equal("\"afoo\<CR>barb", getreg(':'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_paste_visual_mode()
|
||||||
|
new
|
||||||
|
call setline(1, 'here are some words')
|
||||||
|
call feedkeys("0fsve\<Esc>[200~more\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('here are more words', getline(1))
|
||||||
|
call assert_equal('some', getreg('-'))
|
||||||
|
|
||||||
|
" include last char in the line
|
||||||
|
call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('here are more noises', getline(1))
|
||||||
|
call assert_equal('words', getreg('-'))
|
||||||
|
|
||||||
|
" exclude last char in the line
|
||||||
|
call setline(1, 'some words!')
|
||||||
|
call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('some noises!', getline(1))
|
||||||
|
call assert_equal('words', getreg('-'))
|
||||||
|
|
||||||
|
" multi-line selection
|
||||||
|
call setline(1, ['some words', 'and more'])
|
||||||
|
call feedkeys("0fwvj0fd\<Esc>[200~letters\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('some letters more', getline(1))
|
||||||
|
call assert_equal("words\nand", getreg('1'))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
" Tests for stat functions and checktime
|
" Tests for stat functions and checktime
|
||||||
|
|
||||||
func Test_existent_file()
|
func Test_existent_file()
|
||||||
let fname='Xtest.tmp'
|
let fname = 'Xtest.tmp'
|
||||||
|
|
||||||
let ts=localtime()
|
let ts = localtime()
|
||||||
sleep 1
|
let fl = ['Hello World!']
|
||||||
let fl=['Hello World!']
|
|
||||||
call writefile(fl, fname)
|
call writefile(fl, fname)
|
||||||
let tf=getftime(fname)
|
let tf = getftime(fname)
|
||||||
sleep 1
|
let te = localtime()
|
||||||
let te=localtime()
|
|
||||||
|
|
||||||
call assert_true(ts <= tf && tf <= te)
|
call assert_true(ts <= tf && tf <= te)
|
||||||
call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
|
call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
|
||||||
call assert_equal('file', getftype(fname))
|
call assert_equal('file', getftype(fname))
|
||||||
call assert_equal('rw-', getfperm(fname)[0:2])
|
call assert_equal('rw-', getfperm(fname)[0:2])
|
||||||
|
|
||||||
|
call delete(fname)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_existent_directory()
|
func Test_existent_directory()
|
||||||
let dname='.'
|
let dname = '.'
|
||||||
|
|
||||||
call assert_equal(0, getfsize(dname))
|
call assert_equal(0, getfsize(dname))
|
||||||
call assert_equal('dir', getftype(dname))
|
call assert_equal('dir', getftype(dname))
|
||||||
@@ -26,22 +26,29 @@ func Test_existent_directory()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_checktime()
|
func Test_checktime()
|
||||||
let fname='Xtest.tmp'
|
let fname = 'Xtest.tmp'
|
||||||
|
|
||||||
let fl=['Hello World!']
|
let fl = ['Hello World!']
|
||||||
call writefile(fl, fname)
|
call writefile(fl, fname)
|
||||||
set autoread
|
set autoread
|
||||||
exec 'e' fname
|
exec 'e' fname
|
||||||
sleep 2
|
" FAT has a granularity of 2 seconds, otherwise it's usually 1 second
|
||||||
let fl=readfile(fname)
|
if has('win32')
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
endif
|
||||||
|
let fl = readfile(fname)
|
||||||
let fl[0] .= ' - checktime'
|
let fl[0] .= ' - checktime'
|
||||||
call writefile(fl, fname)
|
call writefile(fl, fname)
|
||||||
checktime
|
checktime
|
||||||
call assert_equal(fl[0], getline(1))
|
call assert_equal(fl[0], getline(1))
|
||||||
|
|
||||||
|
call delete(fname)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_nonexistent_file()
|
func Test_nonexistent_file()
|
||||||
let fname='Xtest.tmp'
|
let fname = 'Xtest.tmp'
|
||||||
|
|
||||||
call delete(fname)
|
call delete(fname)
|
||||||
call assert_equal(-1, getftime(fname))
|
call assert_equal(-1, getftime(fname))
|
||||||
@@ -55,7 +62,7 @@ func Test_win32_symlink_dir()
|
|||||||
" So we use an existing symlink for this test.
|
" So we use an existing symlink for this test.
|
||||||
if has('win32')
|
if has('win32')
|
||||||
" Check if 'C:\Users\All Users' is a symlink to a directory.
|
" Check if 'C:\Users\All Users' is a symlink to a directory.
|
||||||
let res=system('dir C:\Users /a')
|
let res = system('dir C:\Users /a')
|
||||||
if match(res, '\C<SYMLINKD> *All Users') >= 0
|
if match(res, '\C<SYMLINKD> *All Users') >= 0
|
||||||
" Get the filetype of the symlink.
|
" Get the filetype of the symlink.
|
||||||
call assert_equal('dir', getftype('C:\Users\All Users'))
|
call assert_equal('dir', getftype('C:\Users\All Users'))
|
||||||
|
|||||||
@@ -23,3 +23,16 @@ func Test_dotregister_paste()
|
|||||||
call assert_equal('hello world world', getline(1))
|
call assert_equal('hello world world', getline(1))
|
||||||
q!
|
q!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_Visual_ctrl_o()
|
||||||
|
new
|
||||||
|
call setline(1, ['one', 'two', 'three'])
|
||||||
|
call cursor(1,2)
|
||||||
|
set noshowmode
|
||||||
|
set tw=0
|
||||||
|
call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx')
|
||||||
|
call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3))
|
||||||
|
call assert_equal(88, &tw)
|
||||||
|
set tw&
|
||||||
|
bw!
|
||||||
|
endfu
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
" Always use "sh", don't use the value of "$SHELL".
|
" Always use "sh", don't use the value of "$SHELL".
|
||||||
set shell=sh
|
set shell=sh
|
||||||
|
|
||||||
" While some tests overwrite $HOME to prevent them from polluting user files,
|
" Only when the +eval feature is present.
|
||||||
" we need to remember the original value so that we can tell external systems
|
if 1
|
||||||
" where to ask about their own user settings.
|
" While some tests overwrite $HOME to prevent them from polluting user files,
|
||||||
let g:tester_HOME = $HOME
|
" we need to remember the original value so that we can tell external systems
|
||||||
|
" where to ask about their own user settings.
|
||||||
|
let g:tester_HOME = $HOME
|
||||||
|
endif
|
||||||
|
|
||||||
source setup.vim
|
source setup.vim
|
||||||
|
|||||||
@@ -1075,12 +1075,17 @@ func_remove(ufunc_T *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free a function and remove it from the list of functions.
|
* Free all things that a function contains. Does not free the function
|
||||||
|
* itself, use func_free() for that.
|
||||||
* When "force" is TRUE we are exiting.
|
* When "force" is TRUE we are exiting.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
func_free(ufunc_T *fp, int force)
|
func_clear(ufunc_T *fp, int force)
|
||||||
{
|
{
|
||||||
|
if (fp->uf_cleared)
|
||||||
|
return;
|
||||||
|
fp->uf_cleared = TRUE;
|
||||||
|
|
||||||
/* clear this function */
|
/* clear this function */
|
||||||
ga_clear_strings(&(fp->uf_args));
|
ga_clear_strings(&(fp->uf_args));
|
||||||
ga_clear_strings(&(fp->uf_lines));
|
ga_clear_strings(&(fp->uf_lines));
|
||||||
@@ -1089,16 +1094,35 @@ func_free(ufunc_T *fp, int force)
|
|||||||
vim_free(fp->uf_tml_total);
|
vim_free(fp->uf_tml_total);
|
||||||
vim_free(fp->uf_tml_self);
|
vim_free(fp->uf_tml_self);
|
||||||
#endif
|
#endif
|
||||||
|
funccal_unref(fp->uf_scoped, fp, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free a function and remove it from the list of functions. Does not free
|
||||||
|
* what a function contains, call func_clear() first.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
func_free(ufunc_T *fp)
|
||||||
|
{
|
||||||
/* only remove it when not done already, otherwise we would remove a newer
|
/* only remove it when not done already, otherwise we would remove a newer
|
||||||
* version of the function */
|
* version of the function */
|
||||||
if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0)
|
if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0)
|
||||||
func_remove(fp);
|
func_remove(fp);
|
||||||
|
|
||||||
funccal_unref(fp->uf_scoped, fp, force);
|
|
||||||
|
|
||||||
vim_free(fp);
|
vim_free(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free all things that a function contains and free the function itself.
|
||||||
|
* When "force" is TRUE we are exiting.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
func_clear_free(ufunc_T *fp, int force)
|
||||||
|
{
|
||||||
|
func_clear(fp, force);
|
||||||
|
func_free(fp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are two kinds of function names:
|
* There are two kinds of function names:
|
||||||
* 1. ordinary names, function defined with :function
|
* 1. ordinary names, function defined with :function
|
||||||
@@ -1120,10 +1144,40 @@ free_all_functions(void)
|
|||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
ufunc_T *fp;
|
ufunc_T *fp;
|
||||||
long_u skipped = 0;
|
long_u skipped = 0;
|
||||||
long_u todo;
|
long_u todo = 1;
|
||||||
|
long_u used;
|
||||||
|
|
||||||
/* Need to start all over every time, because func_free() may change the
|
/* First clear what the functions contain. Since this may lower the
|
||||||
* hash table. */
|
* reference count of a function, it may also free a function and change
|
||||||
|
* the hash table. Restart if that happens. */
|
||||||
|
while (todo > 0)
|
||||||
|
{
|
||||||
|
todo = func_hashtab.ht_used;
|
||||||
|
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
|
||||||
|
if (!HASHITEM_EMPTY(hi))
|
||||||
|
{
|
||||||
|
/* Only free functions that are not refcounted, those are
|
||||||
|
* supposed to be freed when no longer referenced. */
|
||||||
|
fp = HI2UF(hi);
|
||||||
|
if (func_name_refcount(fp->uf_name))
|
||||||
|
++skipped;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
used = func_hashtab.ht_used;
|
||||||
|
func_clear(fp, TRUE);
|
||||||
|
if (used != func_hashtab.ht_used)
|
||||||
|
{
|
||||||
|
skipped = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--todo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now actually free the functions. Need to start all over every time,
|
||||||
|
* because func_free() may change the hash table. */
|
||||||
|
skipped = 0;
|
||||||
while (func_hashtab.ht_used > skipped)
|
while (func_hashtab.ht_used > skipped)
|
||||||
{
|
{
|
||||||
todo = func_hashtab.ht_used;
|
todo = func_hashtab.ht_used;
|
||||||
@@ -1138,7 +1192,7 @@ free_all_functions(void)
|
|||||||
++skipped;
|
++skipped;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
func_free(fp, TRUE);
|
func_free(fp);
|
||||||
skipped = 0;
|
skipped = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1356,7 +1410,7 @@ call_func(
|
|||||||
if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0)
|
if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0)
|
||||||
/* Function was unreferenced while being used, free it
|
/* Function was unreferenced while being used, free it
|
||||||
* now. */
|
* now. */
|
||||||
func_free(fp, FALSE);
|
func_clear_free(fp, FALSE);
|
||||||
if (did_save_redo)
|
if (did_save_redo)
|
||||||
restoreRedobuff();
|
restoreRedobuff();
|
||||||
restore_search_patterns();
|
restore_search_patterns();
|
||||||
@@ -2756,7 +2810,7 @@ ex_delfunction(exarg_T *eap)
|
|||||||
fp->uf_flags |= FC_DELETED;
|
fp->uf_flags |= FC_DELETED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
func_free(fp, FALSE);
|
func_clear_free(fp, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2785,7 +2839,7 @@ func_unref(char_u *name)
|
|||||||
/* Only delete it when it's not being used. Otherwise it's done
|
/* Only delete it when it's not being used. Otherwise it's done
|
||||||
* when "uf_calls" becomes zero. */
|
* when "uf_calls" becomes zero. */
|
||||||
if (fp->uf_calls == 0)
|
if (fp->uf_calls == 0)
|
||||||
func_free(fp, FALSE);
|
func_clear_free(fp, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2801,7 +2855,7 @@ func_ptr_unref(ufunc_T *fp)
|
|||||||
/* Only delete it when it's not being used. Otherwise it's done
|
/* Only delete it when it's not being used. Otherwise it's done
|
||||||
* when "uf_calls" becomes zero. */
|
* when "uf_calls" becomes zero. */
|
||||||
if (fp->uf_calls == 0)
|
if (fp->uf_calls == 0)
|
||||||
func_free(fp, FALSE);
|
func_clear_free(fp, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3556,7 +3610,7 @@ get_funccal_args_var()
|
|||||||
{
|
{
|
||||||
if (current_funccal == NULL)
|
if (current_funccal == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return ¤t_funccal->l_avars_var;
|
return &get_funccal()->l_avars_var;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -764,6 +764,52 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
306,
|
||||||
|
/**/
|
||||||
|
305,
|
||||||
|
/**/
|
||||||
|
304,
|
||||||
|
/**/
|
||||||
|
303,
|
||||||
|
/**/
|
||||||
|
302,
|
||||||
|
/**/
|
||||||
|
301,
|
||||||
|
/**/
|
||||||
|
300,
|
||||||
|
/**/
|
||||||
|
299,
|
||||||
|
/**/
|
||||||
|
298,
|
||||||
|
/**/
|
||||||
|
297,
|
||||||
|
/**/
|
||||||
|
296,
|
||||||
|
/**/
|
||||||
|
295,
|
||||||
|
/**/
|
||||||
|
294,
|
||||||
|
/**/
|
||||||
|
293,
|
||||||
|
/**/
|
||||||
|
292,
|
||||||
|
/**/
|
||||||
|
291,
|
||||||
|
/**/
|
||||||
|
290,
|
||||||
|
/**/
|
||||||
|
289,
|
||||||
|
/**/
|
||||||
|
288,
|
||||||
|
/**/
|
||||||
|
287,
|
||||||
|
/**/
|
||||||
|
286,
|
||||||
|
/**/
|
||||||
|
285,
|
||||||
|
/**/
|
||||||
|
284,
|
||||||
/**/
|
/**/
|
||||||
283,
|
283,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user