mirror of
https://github.com/zoriya/vim.git
synced 2025-12-08 08:16:16 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d9eacefa | ||
|
|
c10f0e7cb0 | ||
|
|
c386267ffe | ||
|
|
b245559fa9 | ||
|
|
e90858d022 | ||
|
|
0b5c93a7f2 | ||
|
|
1266d678bf | ||
|
|
7c23d1d9d9 | ||
|
|
168dd00f72 | ||
|
|
f1ab9c1370 | ||
|
|
56e6bd7ba2 | ||
|
|
3954e3c4b5 | ||
|
|
e3caa11090 | ||
|
|
070b33da93 | ||
|
|
c4a249a736 | ||
|
|
432c839ebd | ||
|
|
a4c906a4a1 | ||
|
|
c593fee0e5 | ||
|
|
85b5743d3e | ||
|
|
d58f03b1c2 | ||
|
|
6fe2eb43d2 | ||
|
|
c625155ea4 | ||
|
|
a58883b4ea | ||
|
|
d297f35eb0 | ||
|
|
80627cf51f | ||
|
|
ddf662a1c8 | ||
|
|
24c2e48ef8 | ||
|
|
dea2570740 | ||
|
|
2f72c70657 |
@@ -5848,9 +5848,13 @@ mode([expr]) Return a string that indicates the current mode.
|
||||
S Select by line
|
||||
CTRL-S Select blockwise
|
||||
i Insert
|
||||
ic Insert mode completion |compl-generic|
|
||||
ix Insert mode |i_CTRL-X| completion
|
||||
R Replace |R|
|
||||
Rc Replace mode completion |compl-generic|
|
||||
Rv Virtual Replace |gR|
|
||||
c Command-line
|
||||
Rx Replace mode |i_CTRL-X| completion
|
||||
c Command-line editing
|
||||
cv Vim Ex mode |gQ|
|
||||
ce Normal Ex mode |Q|
|
||||
r Hit-enter prompt
|
||||
|
||||
@@ -285,8 +285,10 @@ MSVCRT_VER = ($(MSVCVER) / 10 - 50)
|
||||
# Base name of the msvcrXX.dll
|
||||
!if $(MSVCRT_VER) <= 60
|
||||
MSVCRT_NAME = msvcrt
|
||||
!else
|
||||
!elseif $(MSVCRT_VER) <= 130
|
||||
MSVCRT_NAME = msvcr$(MSVCRT_VER)
|
||||
!else
|
||||
MSVCRT_NAME = vcruntime$(MSVCRT_VER)
|
||||
!endif
|
||||
|
||||
!if $(MSVC_MAJOR) == 6
|
||||
|
||||
@@ -2147,6 +2147,7 @@ test_arglist \
|
||||
test_langmap \
|
||||
test_largefile \
|
||||
test_lispwords \
|
||||
test_lua \
|
||||
test_man \
|
||||
test_mapping \
|
||||
test_marks \
|
||||
@@ -2168,6 +2169,8 @@ test_arglist \
|
||||
test_popup \
|
||||
test_profile \
|
||||
test_put \
|
||||
test_python2 \
|
||||
test_python3 \
|
||||
test_pyx2 \
|
||||
test_pyx3 \
|
||||
test_quickfix \
|
||||
@@ -2195,6 +2198,7 @@ test_arglist \
|
||||
test_tabpage \
|
||||
test_tagcase \
|
||||
test_tagjump \
|
||||
test_tcl \
|
||||
test_textobjects \
|
||||
test_timers \
|
||||
test_true_false \
|
||||
|
||||
@@ -6166,6 +6166,9 @@ insertchar(
|
||||
&& (!has_mbyte || MB_BYTE2LEN_CHECK(c) == 1)
|
||||
#endif
|
||||
&& i < INPUT_BUFLEN
|
||||
# ifdef FEAT_FKMAP
|
||||
&& !(p_fkmap && KeyTyped) /* Farsi mode mapping moves cursor */
|
||||
# endif
|
||||
&& (textwidth == 0
|
||||
|| (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth)
|
||||
&& !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1])))
|
||||
@@ -6174,10 +6177,6 @@ insertchar(
|
||||
c = vgetc();
|
||||
if (p_hkmap && KeyTyped)
|
||||
c = hkmap(c); /* Hebrew mode mapping */
|
||||
# ifdef FEAT_FKMAP
|
||||
if (p_fkmap && KeyTyped)
|
||||
c = fkmap(c); /* Farsi mode mapping */
|
||||
# endif
|
||||
buf[i++] = c;
|
||||
#else
|
||||
buf[i++] = vgetc();
|
||||
|
||||
@@ -2819,7 +2819,17 @@ f_execute(typval_T *argvars, typval_T *rettv)
|
||||
--list->lv_refcount;
|
||||
}
|
||||
|
||||
rettv->vval.v_string = redir_execute_ga.ga_data;
|
||||
/* Need to append a NUL to the result. */
|
||||
if (ga_grow(&redir_execute_ga, 1) == OK)
|
||||
{
|
||||
((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL;
|
||||
rettv->vval.v_string = redir_execute_ga.ga_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
ga_clear(&redir_execute_ga);
|
||||
rettv->vval.v_string = NULL;
|
||||
}
|
||||
msg_silent = save_msg_silent;
|
||||
emsg_silent = save_emsg_silent;
|
||||
emsg_noredir = save_emsg_noredir;
|
||||
@@ -7773,21 +7783,26 @@ f_mode(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (State & REPLACE_FLAG)
|
||||
buf[0] = 'R';
|
||||
else
|
||||
buf[0] = 'i';
|
||||
{
|
||||
if (State & REPLACE_FLAG)
|
||||
buf[0] = 'R';
|
||||
else
|
||||
buf[0] = 'i';
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
if (ins_compl_active())
|
||||
buf[1] = 'c';
|
||||
else if (ctrl_x_mode == 1)
|
||||
buf[1] = 'x';
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (State & CMDLINE)
|
||||
else if ((State & CMDLINE) || exmode_active)
|
||||
{
|
||||
buf[0] = 'c';
|
||||
if (exmode_active)
|
||||
if (exmode_active == EXMODE_VIM)
|
||||
buf[1] = 'v';
|
||||
}
|
||||
else if (exmode_active)
|
||||
{
|
||||
buf[0] = 'c';
|
||||
buf[1] = 'e';
|
||||
else if (exmode_active == EXMODE_NORMAL)
|
||||
buf[1] = 'e';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
#define ADDR_LOADED_BUFFERS 3
|
||||
#define ADDR_BUFFERS 4
|
||||
#define ADDR_TABS 5
|
||||
#define ADDR_QUICKFIX 6
|
||||
#define ADDR_TABS_RELATIVE 6 /* Tab page that only relative */
|
||||
#define ADDR_QUICKFIX 7
|
||||
#define ADDR_OTHER 99
|
||||
|
||||
#ifndef DO_DECLARE_EXCMD
|
||||
@@ -1425,9 +1426,9 @@ EX(CMD_tags, "tags", do_tags,
|
||||
ADDR_LINES),
|
||||
EX(CMD_tab, "tab", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM,
|
||||
ADDR_LINES),
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabclose, "tabclose", ex_tabclose,
|
||||
RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN,
|
||||
BANG|RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR|CMDWIN,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabdo, "tabdo", ex_listdo,
|
||||
NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
|
||||
@@ -1440,34 +1441,34 @@ EX(CMD_tabfind, "tabfind", ex_splitview,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabfirst, "tabfirst", ex_tabnext,
|
||||
TRLBAR,
|
||||
ADDR_LINES),
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabmove, "tabmove", ex_tabmove,
|
||||
RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tablast, "tablast", ex_tabnext,
|
||||
TRLBAR,
|
||||
ADDR_LINES),
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabnext, "tabnext", ex_tabnext,
|
||||
RANGE|NOTADR|COUNT|TRLBAR,
|
||||
ADDR_LINES),
|
||||
RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabnew, "tabnew", ex_splitview,
|
||||
BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabonly, "tabonly", ex_tabonly,
|
||||
BANG|RANGE|NOTADR|TRLBAR|CMDWIN,
|
||||
BANG|RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR|CMDWIN,
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabprevious, "tabprevious", ex_tabnext,
|
||||
RANGE|NOTADR|COUNT|TRLBAR,
|
||||
ADDR_LINES),
|
||||
RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR,
|
||||
ADDR_TABS_RELATIVE),
|
||||
EX(CMD_tabNext, "tabNext", ex_tabnext,
|
||||
RANGE|NOTADR|COUNT|TRLBAR,
|
||||
ADDR_LINES),
|
||||
RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR,
|
||||
ADDR_TABS_RELATIVE),
|
||||
EX(CMD_tabrewind, "tabrewind", ex_tabnext,
|
||||
TRLBAR,
|
||||
ADDR_LINES),
|
||||
ADDR_TABS),
|
||||
EX(CMD_tabs, "tabs", ex_tabs,
|
||||
TRLBAR|CMDWIN,
|
||||
ADDR_LINES),
|
||||
ADDR_TABS),
|
||||
EX(CMD_tcl, "tcl", ex_tcl,
|
||||
RANGE|EXTRA|NEEDARG|CMDWIN,
|
||||
ADDR_LINES),
|
||||
|
||||
289
src/ex_docmd.c
289
src/ex_docmd.c
@@ -2162,8 +2162,7 @@ do_one_cmd(
|
||||
ea.line2 = curwin->w_cursor.lnum;
|
||||
break;
|
||||
case ADDR_WINDOWS:
|
||||
lnum = CURRENT_WIN_NR;
|
||||
ea.line2 = lnum;
|
||||
ea.line2 = CURRENT_WIN_NR;
|
||||
break;
|
||||
case ADDR_ARGUMENTS:
|
||||
ea.line2 = curwin->w_arg_idx + 1;
|
||||
@@ -2175,8 +2174,10 @@ do_one_cmd(
|
||||
ea.line2 = curbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
lnum = CURRENT_TAB_NR;
|
||||
ea.line2 = lnum;
|
||||
ea.line2 = CURRENT_TAB_NR;
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
ea.line2 = 1;
|
||||
break;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
case ADDR_QUICKFIX:
|
||||
@@ -2235,6 +2236,10 @@ do_one_cmd(
|
||||
goto doend;
|
||||
}
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
errormsg = (char_u *)_(e_invrange);
|
||||
goto doend;
|
||||
break;
|
||||
case ADDR_ARGUMENTS:
|
||||
if (ARGCOUNT == 0)
|
||||
ea.line1 = ea.line2 = 0;
|
||||
@@ -2710,6 +2715,9 @@ do_one_cmd(
|
||||
case ADDR_TABS:
|
||||
ea.line2 = LAST_TAB_NR;
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
ea.line2 = 1;
|
||||
break;
|
||||
case ADDR_ARGUMENTS:
|
||||
if (ARGCOUNT == 0)
|
||||
ea.line1 = ea.line2 = 0;
|
||||
@@ -2786,7 +2794,8 @@ do_one_cmd(
|
||||
/*
|
||||
* Be vi compatible: no error message for out of range.
|
||||
*/
|
||||
if (ea.line2 > curbuf->b_ml.ml_line_count)
|
||||
if (ea.addr_type == ADDR_LINES
|
||||
&& ea.line2 > curbuf->b_ml.ml_line_count)
|
||||
ea.line2 = curbuf->b_ml.ml_line_count;
|
||||
}
|
||||
}
|
||||
@@ -4427,6 +4436,11 @@ get_address(
|
||||
case ADDR_TABS:
|
||||
lnum = CURRENT_TAB_NR;
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
EMSG(_(e_invrange));
|
||||
cmd = NULL;
|
||||
goto error;
|
||||
break;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
case ADDR_QUICKFIX:
|
||||
lnum = qf_get_cur_valid_idx(eap);
|
||||
@@ -4464,6 +4478,11 @@ get_address(
|
||||
case ADDR_TABS:
|
||||
lnum = LAST_TAB_NR;
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
EMSG(_(e_invrange));
|
||||
cmd = NULL;
|
||||
goto error;
|
||||
break;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
case ADDR_QUICKFIX:
|
||||
lnum = qf_get_size(eap);
|
||||
@@ -4646,6 +4665,9 @@ get_address(
|
||||
case ADDR_TABS:
|
||||
lnum = CURRENT_TAB_NR;
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
lnum = 1;
|
||||
break;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
case ADDR_QUICKFIX:
|
||||
lnum = qf_get_cur_valid_idx(eap);
|
||||
@@ -4662,7 +4684,14 @@ get_address(
|
||||
n = 1;
|
||||
else
|
||||
n = getdigits(&cmd);
|
||||
if (addr_type == ADDR_LOADED_BUFFERS
|
||||
|
||||
if (addr_type == ADDR_TABS_RELATIVE)
|
||||
{
|
||||
EMSG(_(e_invrange));
|
||||
cmd = NULL;
|
||||
goto error;
|
||||
}
|
||||
else if (addr_type == ADDR_LOADED_BUFFERS
|
||||
|| addr_type == ADDR_BUFFERS)
|
||||
lnum = compute_buffer_local_count(
|
||||
addr_type, lnum, (i == '-') ? -1 * n : n);
|
||||
@@ -4795,6 +4824,9 @@ invalid_range(exarg_T *eap)
|
||||
if (eap->line2 > LAST_TAB_NR)
|
||||
return (char_u *)_(e_invrange);
|
||||
break;
|
||||
case ADDR_TABS_RELATIVE:
|
||||
/* Do nothing */
|
||||
break;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
case ADDR_QUICKFIX:
|
||||
if (eap->line2 != 1 && eap->line2 > qf_get_size(eap))
|
||||
@@ -7436,6 +7468,107 @@ ex_win_close(
|
||||
win_close_othertab(win, !need_hide && !P_HID(buf), tp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the argument for a tabpage related ex command.
|
||||
* Returns a tabpage number.
|
||||
* When an error is encountered then eap->errmsg is set.
|
||||
*/
|
||||
static int
|
||||
get_tabpage_arg(exarg_T *eap)
|
||||
{
|
||||
int tab_number;
|
||||
int unaccept_arg0 = (eap->cmdidx == CMD_tabmove) ? 0 : 1;
|
||||
|
||||
if (eap->arg && *eap->arg != NUL)
|
||||
{
|
||||
char_u *p = eap->arg;
|
||||
char_u *p_save;
|
||||
int relative = 0; /* argument +N/-N means: go to N places to the
|
||||
* right/left relative to the current position. */
|
||||
|
||||
if (*p == '-')
|
||||
{
|
||||
relative = -1;
|
||||
p++;
|
||||
}
|
||||
else if (*p == '+')
|
||||
{
|
||||
relative = 1;
|
||||
p++;
|
||||
}
|
||||
|
||||
p_save = p;
|
||||
tab_number = getdigits(&p);
|
||||
|
||||
if (relative == 0)
|
||||
{
|
||||
if (STRCMP(p, "$") == 0)
|
||||
tab_number = LAST_TAB_NR;
|
||||
else if (p == p_save || *p_save == '-' || *p != NUL
|
||||
|| tab_number > LAST_TAB_NR)
|
||||
{
|
||||
/* No numbers as argument. */
|
||||
eap->errmsg = e_invarg;
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*p_save == NUL)
|
||||
tab_number = 1;
|
||||
else if (p == p_save || *p_save == '-' || *p != NUL
|
||||
|| tab_number == 0)
|
||||
{
|
||||
/* No numbers as argument. */
|
||||
eap->errmsg = e_invarg;
|
||||
goto theend;
|
||||
}
|
||||
tab_number = tab_number * relative + tabpage_index(curtab);
|
||||
if (!unaccept_arg0 && relative == -1)
|
||||
--tab_number;
|
||||
}
|
||||
if (tab_number < unaccept_arg0 || tab_number > LAST_TAB_NR)
|
||||
eap->errmsg = e_invarg;
|
||||
}
|
||||
else if (eap->addr_count > 0)
|
||||
{
|
||||
if (unaccept_arg0 && eap->line2 == 0)
|
||||
{
|
||||
eap->errmsg = e_invrange;
|
||||
tab_number = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tab_number = eap->line2;
|
||||
if (!unaccept_arg0 && **eap->cmdlinep == '-')
|
||||
{
|
||||
--tab_number;
|
||||
if (tab_number < unaccept_arg0)
|
||||
eap->errmsg = e_invarg;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (eap->cmdidx)
|
||||
{
|
||||
case CMD_tabnext:
|
||||
tab_number = tabpage_index(curtab) + 1;
|
||||
if (tab_number > LAST_TAB_NR)
|
||||
tab_number = 1;
|
||||
break;
|
||||
case CMD_tabmove:
|
||||
tab_number = LAST_TAB_NR;
|
||||
break;
|
||||
default:
|
||||
tab_number = tabpage_index(curtab);
|
||||
}
|
||||
}
|
||||
|
||||
theend:
|
||||
return tab_number;
|
||||
}
|
||||
|
||||
/*
|
||||
* ":tabclose": close current tab page, unless it is the last one.
|
||||
* ":tabclose N": close tab page N.
|
||||
@@ -7444,6 +7577,7 @@ ex_win_close(
|
||||
ex_tabclose(exarg_T *eap)
|
||||
{
|
||||
tabpage_T *tp;
|
||||
int tab_number;
|
||||
|
||||
# ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
@@ -7454,9 +7588,10 @@ ex_tabclose(exarg_T *eap)
|
||||
EMSG(_("E784: Cannot close last tab page"));
|
||||
else
|
||||
{
|
||||
if (eap->addr_count > 0)
|
||||
tab_number = get_tabpage_arg(eap);
|
||||
if (eap->errmsg == NULL)
|
||||
{
|
||||
tp = find_tabpage((int)eap->line2);
|
||||
tp = find_tabpage(tab_number);
|
||||
if (tp == NULL)
|
||||
{
|
||||
beep_flush();
|
||||
@@ -7467,13 +7602,13 @@ ex_tabclose(exarg_T *eap)
|
||||
tabpage_close_other(tp, eap->forceit);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!text_locked()
|
||||
else if (!text_locked()
|
||||
#ifdef FEAT_AUTOCMD
|
||||
&& !curbuf_locked()
|
||||
&& !curbuf_locked()
|
||||
#endif
|
||||
)
|
||||
tabpage_close(eap->forceit);
|
||||
)
|
||||
tabpage_close(eap->forceit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7485,6 +7620,7 @@ ex_tabonly(exarg_T *eap)
|
||||
{
|
||||
tabpage_T *tp;
|
||||
int done;
|
||||
int tab_number;
|
||||
|
||||
# ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
@@ -7495,24 +7631,27 @@ ex_tabonly(exarg_T *eap)
|
||||
MSG(_("Already only one tab page"));
|
||||
else
|
||||
{
|
||||
if (eap->addr_count > 0)
|
||||
goto_tabpage(eap->line2);
|
||||
/* Repeat this up to a 1000 times, because autocommands may mess
|
||||
* up the lists. */
|
||||
for (done = 0; done < 1000; ++done)
|
||||
tab_number = get_tabpage_arg(eap);
|
||||
if (eap->errmsg == NULL)
|
||||
{
|
||||
FOR_ALL_TABPAGES(tp)
|
||||
if (tp->tp_topframe != topframe)
|
||||
{
|
||||
tabpage_close_other(tp, eap->forceit);
|
||||
/* if we failed to close it quit */
|
||||
if (valid_tabpage(tp))
|
||||
done = 1000;
|
||||
/* start over, "tp" is now invalid */
|
||||
goto_tabpage(tab_number);
|
||||
/* Repeat this up to a 1000 times, because autocommands may
|
||||
* mess up the lists. */
|
||||
for (done = 0; done < 1000; ++done)
|
||||
{
|
||||
FOR_ALL_TABPAGES(tp)
|
||||
if (tp->tp_topframe != topframe)
|
||||
{
|
||||
tabpage_close_other(tp, eap->forceit);
|
||||
/* if we failed to close it quit */
|
||||
if (valid_tabpage(tp))
|
||||
done = 1000;
|
||||
/* start over, "tp" is now invalid */
|
||||
break;
|
||||
}
|
||||
if (first_tabpage->tp_next == NULL)
|
||||
break;
|
||||
}
|
||||
if (first_tabpage->tp_next == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8254,6 +8393,8 @@ tabpage_new(void)
|
||||
static void
|
||||
ex_tabnext(exarg_T *eap)
|
||||
{
|
||||
int tab_number;
|
||||
|
||||
switch (eap->cmdidx)
|
||||
{
|
||||
case CMD_tabfirst:
|
||||
@@ -8265,10 +8406,40 @@ ex_tabnext(exarg_T *eap)
|
||||
break;
|
||||
case CMD_tabprevious:
|
||||
case CMD_tabNext:
|
||||
goto_tabpage(eap->addr_count == 0 ? -1 : -(int)eap->line2);
|
||||
if (eap->arg && *eap->arg != NUL)
|
||||
{
|
||||
char_u *p = eap->arg;
|
||||
char_u *p_save = p;
|
||||
|
||||
tab_number = getdigits(&p);
|
||||
if (p == p_save || *p_save == '-' || *p != NUL
|
||||
|| tab_number == 0)
|
||||
{
|
||||
/* No numbers as argument. */
|
||||
eap->errmsg = e_invarg;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eap->addr_count == 0)
|
||||
tab_number = 1;
|
||||
else
|
||||
{
|
||||
tab_number = eap->line2;
|
||||
if (tab_number < 1)
|
||||
{
|
||||
eap->errmsg = e_invrange;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto_tabpage(-tab_number);
|
||||
break;
|
||||
default: /* CMD_tabnext */
|
||||
goto_tabpage(eap->addr_count == 0 ? 0 : (int)eap->line2);
|
||||
tab_number = get_tabpage_arg(eap);
|
||||
if (eap->errmsg == NULL)
|
||||
goto_tabpage(tab_number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -8281,59 +8452,9 @@ ex_tabmove(exarg_T *eap)
|
||||
{
|
||||
int tab_number;
|
||||
|
||||
if (eap->arg && *eap->arg != NUL)
|
||||
{
|
||||
char_u *p = eap->arg;
|
||||
int relative = 0; /* argument +N/-N means: move N places to the
|
||||
* right/left relative to the current position. */
|
||||
|
||||
if (*eap->arg == '-')
|
||||
{
|
||||
relative = -1;
|
||||
p = eap->arg + 1;
|
||||
}
|
||||
else if (*eap->arg == '+')
|
||||
{
|
||||
relative = 1;
|
||||
p = eap->arg + 1;
|
||||
}
|
||||
else
|
||||
p = eap->arg;
|
||||
|
||||
if (relative == 0)
|
||||
{
|
||||
if (STRCMP(p, "$") == 0)
|
||||
tab_number = LAST_TAB_NR;
|
||||
else if (p == skipdigits(p))
|
||||
{
|
||||
/* No numbers as argument. */
|
||||
eap->errmsg = e_invarg;
|
||||
return;
|
||||
}
|
||||
else
|
||||
tab_number = getdigits(&p);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*p != NUL)
|
||||
tab_number = getdigits(&p);
|
||||
else
|
||||
tab_number = 1;
|
||||
tab_number = tab_number * relative + tabpage_index(curtab);
|
||||
if (relative == -1)
|
||||
--tab_number;
|
||||
}
|
||||
}
|
||||
else if (eap->addr_count != 0)
|
||||
{
|
||||
tab_number = eap->line2;
|
||||
if (**eap->cmdlinep == '-')
|
||||
--tab_number;
|
||||
}
|
||||
else
|
||||
tab_number = LAST_TAB_NR;
|
||||
|
||||
tabpage_move(tab_number);
|
||||
tab_number = get_tabpage_arg(eap);
|
||||
if (eap->errmsg == NULL)
|
||||
tabpage_move(tab_number);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
694
src/farsi.c
694
src/farsi.c
@@ -15,30 +15,11 @@
|
||||
|
||||
#if defined(FEAT_FKMAP) || defined(PROTO)
|
||||
|
||||
static int toF_Xor_X_(int c);
|
||||
static int F_is_TyE(int c);
|
||||
static int F_is_TyC_TyD(int c);
|
||||
static int F_is_TyB_TyC_TyD(int src, int offset);
|
||||
static int toF_TyB(int c);
|
||||
static void put_curr_and_l_to_X(int c);
|
||||
static void put_and_redo(int c);
|
||||
static void chg_c_toX_orX(void);
|
||||
static void chg_c_to_X_orX_(void);
|
||||
static void chg_c_to_X_or_X(void);
|
||||
static void chg_l_to_X_orX_(void);
|
||||
static void chg_l_toXor_X(void);
|
||||
static void chg_r_to_Xor_X_(void);
|
||||
static int toF_leading(int c);
|
||||
static int toF_Rjoin(int c);
|
||||
static int canF_Ljoin(int c);
|
||||
static int canF_Rjoin(int c);
|
||||
static int F_isterm(int c);
|
||||
static int toF_ending(int c);
|
||||
static void lrswapbuf(char_u *buf, int len);
|
||||
|
||||
/*
|
||||
* Convert the given Farsi character into a _X or _X_ type
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_Xor_X_(int c)
|
||||
{
|
||||
@@ -105,7 +86,7 @@ toF_Xor_X_(int c)
|
||||
|
||||
/*
|
||||
* Convert the given Farsi character into Farsi capital character.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_TyA(int c)
|
||||
{
|
||||
@@ -156,7 +137,7 @@ toF_TyA(int c)
|
||||
* Is the character under the cursor+offset in the given buffer a join type.
|
||||
* That is a character that is combined with the others.
|
||||
* Note: the offset is used only for command line buffer.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
F_is_TyB_TyC_TyD(int src, int offset)
|
||||
{
|
||||
@@ -207,7 +188,7 @@ F_is_TyB_TyC_TyD(int src, int offset)
|
||||
|
||||
/*
|
||||
* Is the Farsi character one of the terminating only type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
F_is_TyE(int c)
|
||||
{
|
||||
@@ -230,7 +211,7 @@ F_is_TyE(int c)
|
||||
|
||||
/*
|
||||
* Is the Farsi character one of the none leading type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
F_is_TyC_TyD(int c)
|
||||
{
|
||||
@@ -254,7 +235,7 @@ F_is_TyC_TyD(int c)
|
||||
|
||||
/*
|
||||
* Convert a none leading Farsi char into a leading type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_TyB(int c)
|
||||
{
|
||||
@@ -275,9 +256,18 @@ toF_TyB(int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
put_and_redo(int c)
|
||||
{
|
||||
pchar_cursor(c);
|
||||
AppendCharToRedobuff(K_BS);
|
||||
AppendCharToRedobuff(c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Overwrite the current redo and cursor characters + left adjust.
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
put_curr_and_l_to_X(int c)
|
||||
{
|
||||
@@ -312,17 +302,9 @@ put_curr_and_l_to_X(int c)
|
||||
put_and_redo(c);
|
||||
}
|
||||
|
||||
static void
|
||||
put_and_redo(int c)
|
||||
{
|
||||
pchar_cursor(c);
|
||||
AppendCharToRedobuff(K_BS);
|
||||
AppendCharToRedobuff(c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the char. under the cursor to a X_ or X type
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
chg_c_toX_orX(void)
|
||||
{
|
||||
@@ -446,8 +428,7 @@ chg_c_toX_orX(void)
|
||||
|
||||
/*
|
||||
* Change the char. under the cursor to a _X_ or X_ type
|
||||
*/
|
||||
|
||||
*/
|
||||
static void
|
||||
chg_c_to_X_orX_(void)
|
||||
{
|
||||
@@ -498,9 +479,9 @@ chg_c_to_X_orX_(void)
|
||||
|
||||
/*
|
||||
* Change the char. under the cursor to a _X_ or _X type
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
chg_c_to_X_or_X (void)
|
||||
chg_c_to_X_or_X(void)
|
||||
{
|
||||
int tempc;
|
||||
|
||||
@@ -529,7 +510,7 @@ chg_c_to_X_or_X (void)
|
||||
|
||||
/*
|
||||
* Change the character left to the cursor to a _X_ or X_ type
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
chg_l_to_X_orX_(void)
|
||||
{
|
||||
@@ -597,10 +578,9 @@ chg_l_to_X_orX_(void)
|
||||
|
||||
/*
|
||||
* Change the character left to the cursor to a X or _X type
|
||||
*/
|
||||
|
||||
*/
|
||||
static void
|
||||
chg_l_toXor_X (void)
|
||||
chg_l_toXor_X(void)
|
||||
{
|
||||
int tempc;
|
||||
|
||||
@@ -666,8 +646,7 @@ chg_l_toXor_X (void)
|
||||
|
||||
/*
|
||||
* Change the character right to the cursor to a _X or _X_ type
|
||||
*/
|
||||
|
||||
*/
|
||||
static void
|
||||
chg_r_to_Xor_X_(void)
|
||||
{
|
||||
@@ -691,48 +670,50 @@ chg_r_to_Xor_X_(void)
|
||||
|
||||
/*
|
||||
* Map Farsi keyboard when in fkmap mode.
|
||||
*/
|
||||
|
||||
*/
|
||||
int
|
||||
fkmap(int c)
|
||||
{
|
||||
int tempc;
|
||||
static int revins;
|
||||
int insert_mode = (State & INSERT);
|
||||
static int revins = 0;
|
||||
|
||||
if (IS_SPECIAL(c))
|
||||
return c;
|
||||
|
||||
if (VIM_ISDIGIT(c) || ((c == '.' || c == '+' || c == '-' ||
|
||||
c == '^' || c == '%' || c == '#' || c == '=') && revins))
|
||||
if (insert_mode)
|
||||
{
|
||||
if (!revins)
|
||||
if (VIM_ISDIGIT(c) || ((c == '.' || c == '+' || c == '-' ||
|
||||
c == '^' || c == '%' || c == '#' || c == '=') && revins))
|
||||
{
|
||||
if (curwin->w_cursor.col)
|
||||
/* Numbers are entered left-to-right. */
|
||||
if (!revins)
|
||||
{
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
if (curwin->w_cursor.col)
|
||||
{
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
|
||||
chg_c_toX_orX ();
|
||||
chg_l_toXor_X ();
|
||||
chg_c_toX_orX ();
|
||||
chg_l_toXor_X ();
|
||||
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
arrow_used = TRUE;
|
||||
(void)stop_arrow();
|
||||
|
||||
if (!curwin->w_p_rl && revins)
|
||||
inc_cursor();
|
||||
|
||||
++revins;
|
||||
p_ri = 1;
|
||||
}
|
||||
|
||||
arrow_used = TRUE;
|
||||
(void)stop_arrow();
|
||||
|
||||
if (!curwin->w_p_rl && revins)
|
||||
inc_cursor();
|
||||
|
||||
++revins;
|
||||
p_ri=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (revins)
|
||||
else if (revins)
|
||||
{
|
||||
/* Stop entering number. */
|
||||
arrow_used = TRUE;
|
||||
(void)stop_arrow();
|
||||
|
||||
@@ -773,14 +754,14 @@ fkmap(int c)
|
||||
if (!revins)
|
||||
{
|
||||
if (curwin->w_p_rl)
|
||||
p_ri=0;
|
||||
p_ri = 0;
|
||||
if (!curwin->w_p_rl)
|
||||
p_ri=1;
|
||||
p_ri = 1;
|
||||
}
|
||||
|
||||
if ((c < 0x100) && (isalpha(c) || c == '&' || c == '^' || c == ';' ||
|
||||
if ((c < 0x100) && (isalpha(c) || c == '&' || c == '^' || c == ';' ||
|
||||
c == '\''|| c == ',' || c == '[' ||
|
||||
c == ']' || c == '{' || c == '}' ))
|
||||
c == ']' || c == '{' || c == '}'))
|
||||
chg_r_to_Xor_X_();
|
||||
|
||||
tempc = 0;
|
||||
@@ -844,13 +825,12 @@ fkmap(int c)
|
||||
case NL:
|
||||
case TAB:
|
||||
|
||||
if (p_ri && c == NL && curwin->w_cursor.col)
|
||||
if (p_ri && c == NL && curwin->w_cursor.col && insert_mode)
|
||||
{
|
||||
/*
|
||||
* If the char before the cursor is _X_ or X_ do not change
|
||||
* the one under the cursor with X type.
|
||||
*/
|
||||
|
||||
*/
|
||||
dec_cursor();
|
||||
|
||||
if (F_isalpha(gchar_cursor()))
|
||||
@@ -920,215 +900,219 @@ fkmap(int c)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
|
||||
switch ((tempc = gchar_cursor()))
|
||||
if (insert_mode)
|
||||
{
|
||||
case _BE:
|
||||
case _PE:
|
||||
case _TE:
|
||||
case _SE:
|
||||
case _JIM:
|
||||
case _CHE:
|
||||
case _HE_J:
|
||||
case _XE:
|
||||
case _SIN:
|
||||
case _SHIN:
|
||||
case _SAD:
|
||||
case _ZAD:
|
||||
case _FE:
|
||||
case _GHAF:
|
||||
case _KAF:
|
||||
case _KAF_H:
|
||||
case _GAF:
|
||||
case _LAM:
|
||||
case _MIM:
|
||||
case _NOON:
|
||||
case _HE:
|
||||
case _HE_:
|
||||
case _TA:
|
||||
case _ZA:
|
||||
put_curr_and_l_to_X(toF_TyA(tempc));
|
||||
break;
|
||||
case _AYN:
|
||||
case _AYN_:
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X(AYN);
|
||||
break;
|
||||
}
|
||||
switch ((tempc = gchar_cursor()))
|
||||
{
|
||||
case _BE:
|
||||
case _PE:
|
||||
case _TE:
|
||||
case _SE:
|
||||
case _JIM:
|
||||
case _CHE:
|
||||
case _HE_J:
|
||||
case _XE:
|
||||
case _SIN:
|
||||
case _SHIN:
|
||||
case _SAD:
|
||||
case _ZAD:
|
||||
case _FE:
|
||||
case _GHAF:
|
||||
case _KAF:
|
||||
case _KAF_H:
|
||||
case _GAF:
|
||||
case _LAM:
|
||||
case _MIM:
|
||||
case _NOON:
|
||||
case _HE:
|
||||
case _HE_:
|
||||
case _TA:
|
||||
case _ZA:
|
||||
put_curr_and_l_to_X(toF_TyA(tempc));
|
||||
break;
|
||||
case _AYN:
|
||||
case _AYN_:
|
||||
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X(AYN);
|
||||
break;
|
||||
}
|
||||
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = AYN_;
|
||||
else
|
||||
tempc = AYN;
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = AYN_;
|
||||
else
|
||||
tempc = AYN;
|
||||
|
||||
put_curr_and_l_to_X(tempc);
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
|
||||
break;
|
||||
case _GHAYN:
|
||||
case _GHAYN_:
|
||||
put_curr_and_l_to_X(tempc);
|
||||
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X(GHAYN);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case _GHAYN:
|
||||
case _GHAYN_:
|
||||
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X(GHAYN);
|
||||
break;
|
||||
}
|
||||
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = GHAYN_;
|
||||
else
|
||||
tempc = GHAYN;
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = GHAYN_;
|
||||
else
|
||||
tempc = GHAYN;
|
||||
|
||||
put_curr_and_l_to_X(tempc);
|
||||
break;
|
||||
case _YE:
|
||||
case _IE:
|
||||
case _YEE:
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X((tempc == _YE ? YE :
|
||||
(tempc == _IE ? IE : YEE)));
|
||||
break;
|
||||
}
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
put_curr_and_l_to_X(tempc);
|
||||
break;
|
||||
case _YE:
|
||||
case _IE:
|
||||
case _YEE:
|
||||
if (!p_ri)
|
||||
if (!curwin->w_cursor.col)
|
||||
{
|
||||
put_curr_and_l_to_X((tempc == _YE ? YE :
|
||||
(tempc == _IE ? IE : YEE)));
|
||||
break;
|
||||
}
|
||||
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = (tempc == _YE ? YE_ :
|
||||
(tempc == _IE ? IE_ : YEE_));
|
||||
else
|
||||
tempc = (tempc == _YE ? YE :
|
||||
(tempc == _IE ? IE : YEE));
|
||||
if (p_ri)
|
||||
inc_cursor();
|
||||
else
|
||||
dec_cursor();
|
||||
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = (tempc == _YE ? YE_ :
|
||||
(tempc == _IE ? IE_ : YEE_));
|
||||
else
|
||||
tempc = (tempc == _YE ? YE :
|
||||
(tempc == _IE ? IE : YEE));
|
||||
|
||||
put_curr_and_l_to_X(tempc);
|
||||
break;
|
||||
if (p_ri)
|
||||
dec_cursor();
|
||||
else
|
||||
inc_cursor();
|
||||
|
||||
put_curr_and_l_to_X(tempc);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
}
|
||||
|
||||
tempc = 0;
|
||||
tempc = 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '0': return FARSI_0;
|
||||
case '1': return FARSI_1;
|
||||
case '2': return FARSI_2;
|
||||
case '3': return FARSI_3;
|
||||
case '4': return FARSI_4;
|
||||
case '5': return FARSI_5;
|
||||
case '6': return FARSI_6;
|
||||
case '7': return FARSI_7;
|
||||
case '8': return FARSI_8;
|
||||
case '9': return FARSI_9;
|
||||
case 'B': return F_PSP;
|
||||
case 'E': return JAZR_N;
|
||||
case 'F': return ALEF_D_H;
|
||||
case 'H': return ALEF_A;
|
||||
case 'I': return TASH;
|
||||
case 'K': return F_LQUOT;
|
||||
case 'L': return F_RQUOT;
|
||||
case 'M': return HAMZE;
|
||||
case 'O': return '[';
|
||||
case 'P': return ']';
|
||||
case 'Q': return OO;
|
||||
case 'R': return MAD_N;
|
||||
case 'T': return OW;
|
||||
case 'U': return MAD;
|
||||
case 'W': return OW_OW;
|
||||
case 'Y': return JAZR;
|
||||
case '`': return F_PCN;
|
||||
case '!': return F_EXCL;
|
||||
case '@': return F_COMMA;
|
||||
case '#': return F_DIVIDE;
|
||||
case '$': return F_CURRENCY;
|
||||
case '%': return F_PERCENT;
|
||||
case '^': return F_MUL;
|
||||
case '&': return F_BCOMMA;
|
||||
case '*': return F_STAR;
|
||||
case '(': return F_LPARENT;
|
||||
case ')': return F_RPARENT;
|
||||
case '-': return F_MINUS;
|
||||
case '_': return F_UNDERLINE;
|
||||
case '=': return F_EQUALS;
|
||||
case '+': return F_PLUS;
|
||||
case '\\': return F_BSLASH;
|
||||
case '|': return F_PIPE;
|
||||
case ':': return F_DCOLON;
|
||||
case '"': return F_SEMICOLON;
|
||||
case '.': return F_PERIOD;
|
||||
case '/': return F_SLASH;
|
||||
case '<': return F_LESS;
|
||||
case '>': return F_GREATER;
|
||||
case '?': return F_QUESTION;
|
||||
case ' ': return F_BLANK;
|
||||
}
|
||||
break;
|
||||
switch (c)
|
||||
{
|
||||
case '0': return FARSI_0;
|
||||
case '1': return FARSI_1;
|
||||
case '2': return FARSI_2;
|
||||
case '3': return FARSI_3;
|
||||
case '4': return FARSI_4;
|
||||
case '5': return FARSI_5;
|
||||
case '6': return FARSI_6;
|
||||
case '7': return FARSI_7;
|
||||
case '8': return FARSI_8;
|
||||
case '9': return FARSI_9;
|
||||
case 'B': return F_PSP;
|
||||
case 'E': return JAZR_N;
|
||||
case 'F': return ALEF_D_H;
|
||||
case 'H': return ALEF_A;
|
||||
case 'I': return TASH;
|
||||
case 'K': return F_LQUOT;
|
||||
case 'L': return F_RQUOT;
|
||||
case 'M': return HAMZE;
|
||||
case 'O': return '[';
|
||||
case 'P': return ']';
|
||||
case 'Q': return OO;
|
||||
case 'R': return MAD_N;
|
||||
case 'T': return OW;
|
||||
case 'U': return MAD;
|
||||
case 'W': return OW_OW;
|
||||
case 'Y': return JAZR;
|
||||
case '`': return F_PCN;
|
||||
case '!': return F_EXCL;
|
||||
case '@': return F_COMMA;
|
||||
case '#': return F_DIVIDE;
|
||||
case '$': return F_CURRENCY;
|
||||
case '%': return F_PERCENT;
|
||||
case '^': return F_MUL;
|
||||
case '&': return F_BCOMMA;
|
||||
case '*': return F_STAR;
|
||||
case '(': return F_LPARENT;
|
||||
case ')': return F_RPARENT;
|
||||
case '-': return F_MINUS;
|
||||
case '_': return F_UNDERLINE;
|
||||
case '=': return F_EQUALS;
|
||||
case '+': return F_PLUS;
|
||||
case '\\': return F_BSLASH;
|
||||
case '|': return F_PIPE;
|
||||
case ':': return F_DCOLON;
|
||||
case '"': return F_SEMICOLON;
|
||||
case '.': return F_PERIOD;
|
||||
case '/': return F_SLASH;
|
||||
case '<': return F_LESS;
|
||||
case '>': return F_GREATER;
|
||||
case '?': return F_QUESTION;
|
||||
case ' ': return F_BLANK;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
tempc = _SHIN;
|
||||
break;
|
||||
tempc = _SHIN;
|
||||
break;
|
||||
case 'A':
|
||||
tempc = WAW_H;
|
||||
break;
|
||||
tempc = WAW_H;
|
||||
break;
|
||||
case 'b':
|
||||
tempc = ZAL;
|
||||
break;
|
||||
tempc = ZAL;
|
||||
break;
|
||||
case 'c':
|
||||
tempc = ZE;
|
||||
break;
|
||||
tempc = ZE;
|
||||
break;
|
||||
case 'C':
|
||||
tempc = JE;
|
||||
break;
|
||||
tempc = JE;
|
||||
break;
|
||||
case 'd':
|
||||
tempc = _YE;
|
||||
break;
|
||||
tempc = _YE;
|
||||
break;
|
||||
case 'D':
|
||||
tempc = _YEE;
|
||||
break;
|
||||
tempc = _YEE;
|
||||
break;
|
||||
case 'e':
|
||||
tempc = _SE;
|
||||
break;
|
||||
tempc = _SE;
|
||||
break;
|
||||
case 'f':
|
||||
tempc = _BE;
|
||||
break;
|
||||
tempc = _BE;
|
||||
break;
|
||||
case 'g':
|
||||
tempc = _LAM;
|
||||
break;
|
||||
tempc = _LAM;
|
||||
break;
|
||||
case 'G':
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
{
|
||||
@@ -1230,7 +1214,7 @@ fkmap(int c)
|
||||
inc_cursor();
|
||||
break;
|
||||
case 'j':
|
||||
tempc = _TE;
|
||||
tempc = _TE;
|
||||
break;
|
||||
case 'J':
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
@@ -1260,73 +1244,73 @@ fkmap(int c)
|
||||
|
||||
return tempc;
|
||||
case 'k':
|
||||
tempc = _NOON;
|
||||
tempc = _NOON;
|
||||
break;
|
||||
case 'l':
|
||||
tempc = _MIM;
|
||||
tempc = _MIM;
|
||||
break;
|
||||
case 'm':
|
||||
tempc = _PE;
|
||||
tempc = _PE;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
tempc = DAL;
|
||||
tempc = DAL;
|
||||
break;
|
||||
case 'o':
|
||||
tempc = _XE;
|
||||
tempc = _XE;
|
||||
break;
|
||||
case 'p':
|
||||
tempc = _HE_J;
|
||||
tempc = _HE_J;
|
||||
break;
|
||||
case 'q':
|
||||
tempc = _ZAD;
|
||||
tempc = _ZAD;
|
||||
break;
|
||||
case 'r':
|
||||
tempc = _GHAF;
|
||||
tempc = _GHAF;
|
||||
break;
|
||||
case 's':
|
||||
tempc = _SIN;
|
||||
tempc = _SIN;
|
||||
break;
|
||||
case 'S':
|
||||
tempc = _IE;
|
||||
tempc = _IE;
|
||||
break;
|
||||
case 't':
|
||||
tempc = _FE;
|
||||
tempc = _FE;
|
||||
break;
|
||||
case 'u':
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
{
|
||||
if (!p_ri && !F_is_TyE(tempc))
|
||||
chg_c_to_X_orX_ ();
|
||||
if (p_ri)
|
||||
chg_c_to_X_or_X ();
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
{
|
||||
if (!p_ri && !F_is_TyE(tempc))
|
||||
chg_c_to_X_orX_ ();
|
||||
if (p_ri)
|
||||
chg_c_to_X_or_X ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!p_ri && !curwin->w_cursor.col)
|
||||
return _AYN;
|
||||
if (!p_ri && !curwin->w_cursor.col)
|
||||
return _AYN;
|
||||
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
if (!p_ri)
|
||||
dec_cursor();
|
||||
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = _AYN_;
|
||||
else
|
||||
tempc = _AYN;
|
||||
if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))
|
||||
tempc = _AYN_;
|
||||
else
|
||||
tempc = _AYN;
|
||||
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
break;
|
||||
case 'v':
|
||||
case 'V':
|
||||
tempc = RE;
|
||||
tempc = RE;
|
||||
break;
|
||||
case 'w':
|
||||
tempc = _SAD;
|
||||
tempc = _SAD;
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
tempc = _TA;
|
||||
tempc = _TA;
|
||||
break;
|
||||
case 'y':
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
@@ -1354,36 +1338,36 @@ fkmap(int c)
|
||||
|
||||
break;
|
||||
case 'z':
|
||||
tempc = _ZA;
|
||||
tempc = _ZA;
|
||||
break;
|
||||
case 'Z':
|
||||
tempc = _KAF_H;
|
||||
tempc = _KAF_H;
|
||||
break;
|
||||
case ';':
|
||||
tempc = _KAF;
|
||||
tempc = _KAF;
|
||||
break;
|
||||
case '\'':
|
||||
tempc = _GAF;
|
||||
tempc = _GAF;
|
||||
break;
|
||||
case ',':
|
||||
tempc = WAW;
|
||||
tempc = WAW;
|
||||
break;
|
||||
case '[':
|
||||
tempc = _JIM;
|
||||
tempc = _JIM;
|
||||
break;
|
||||
case ']':
|
||||
tempc = _CHE;
|
||||
tempc = _CHE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((F_isalpha(tempc) || F_isdigit(tempc)))
|
||||
if (F_isalpha(tempc) || F_isdigit(tempc))
|
||||
{
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
if (!curwin->w_cursor.col && STRLEN(ml_get_curline()))
|
||||
{
|
||||
if (!p_ri && !F_is_TyE(tempc))
|
||||
chg_c_to_X_orX_ ();
|
||||
chg_c_to_X_orX_();
|
||||
if (p_ri)
|
||||
chg_c_to_X_or_X ();
|
||||
chg_c_to_X_or_X();
|
||||
}
|
||||
|
||||
if (curwin->w_cursor.col)
|
||||
@@ -1392,9 +1376,9 @@ fkmap(int c)
|
||||
dec_cursor();
|
||||
|
||||
if (F_is_TyE(tempc))
|
||||
chg_l_toXor_X ();
|
||||
chg_l_toXor_X();
|
||||
else
|
||||
chg_l_to_X_orX_ ();
|
||||
chg_l_to_X_orX_();
|
||||
|
||||
if (!p_ri)
|
||||
inc_cursor();
|
||||
@@ -1407,7 +1391,7 @@ fkmap(int c)
|
||||
|
||||
/*
|
||||
* Convert a none leading Farsi char into a leading type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_leading(int c)
|
||||
{
|
||||
@@ -1461,7 +1445,7 @@ toF_leading(int c)
|
||||
|
||||
/*
|
||||
* Convert a given Farsi char into right joining type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_Rjoin(int c)
|
||||
{
|
||||
@@ -1517,7 +1501,7 @@ toF_Rjoin(int c)
|
||||
|
||||
/*
|
||||
* Can a given Farsi character join via its left edj.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
canF_Ljoin(int c)
|
||||
{
|
||||
@@ -1591,7 +1575,7 @@ canF_Ljoin(int c)
|
||||
|
||||
/*
|
||||
* Can a given Farsi character join via its right edj.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
canF_Rjoin(int c)
|
||||
{
|
||||
@@ -1619,7 +1603,7 @@ canF_Rjoin(int c)
|
||||
|
||||
/*
|
||||
* is a given Farsi character a terminating type.
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
F_isterm(int c)
|
||||
{
|
||||
@@ -1646,7 +1630,7 @@ F_isterm(int c)
|
||||
|
||||
/*
|
||||
* Convert the given Farsi character into a ending type .
|
||||
*/
|
||||
*/
|
||||
static int
|
||||
toF_ending(int c)
|
||||
{
|
||||
@@ -1691,7 +1675,7 @@ toF_ending(int c)
|
||||
|
||||
/*
|
||||
* Convert the Farsi 3342 standard into Farsi VIM.
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
conv_to_pvim(void)
|
||||
{
|
||||
@@ -1936,56 +1920,56 @@ cmdl_fkmap(int c)
|
||||
case NL:
|
||||
case TAB:
|
||||
|
||||
switch ((tempc = cmd_gchar(AT_CURSOR)))
|
||||
{
|
||||
case _BE:
|
||||
case _PE:
|
||||
case _TE:
|
||||
case _SE:
|
||||
case _JIM:
|
||||
case _CHE:
|
||||
case _HE_J:
|
||||
case _XE:
|
||||
case _SIN:
|
||||
case _SHIN:
|
||||
case _SAD:
|
||||
case _ZAD:
|
||||
case _AYN:
|
||||
case _GHAYN:
|
||||
case _FE:
|
||||
case _GHAF:
|
||||
case _KAF:
|
||||
case _GAF:
|
||||
case _LAM:
|
||||
case _MIM:
|
||||
case _NOON:
|
||||
case _HE:
|
||||
case _HE_:
|
||||
cmd_pchar(toF_TyA(tempc), AT_CURSOR);
|
||||
break;
|
||||
case _AYN_:
|
||||
cmd_pchar(AYN_, AT_CURSOR);
|
||||
break;
|
||||
case _GHAYN_:
|
||||
cmd_pchar(GHAYN_, AT_CURSOR);
|
||||
break;
|
||||
case _IE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(IE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(IE, AT_CURSOR);
|
||||
break;
|
||||
case _YEE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(YEE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(YEE, AT_CURSOR);
|
||||
break;
|
||||
case _YE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(YE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(YE, AT_CURSOR);
|
||||
switch ((tempc = cmd_gchar(AT_CURSOR)))
|
||||
{
|
||||
case _BE:
|
||||
case _PE:
|
||||
case _TE:
|
||||
case _SE:
|
||||
case _JIM:
|
||||
case _CHE:
|
||||
case _HE_J:
|
||||
case _XE:
|
||||
case _SIN:
|
||||
case _SHIN:
|
||||
case _SAD:
|
||||
case _ZAD:
|
||||
case _AYN:
|
||||
case _GHAYN:
|
||||
case _FE:
|
||||
case _GHAF:
|
||||
case _KAF:
|
||||
case _GAF:
|
||||
case _LAM:
|
||||
case _MIM:
|
||||
case _NOON:
|
||||
case _HE:
|
||||
case _HE_:
|
||||
cmd_pchar(toF_TyA(tempc), AT_CURSOR);
|
||||
break;
|
||||
case _AYN_:
|
||||
cmd_pchar(AYN_, AT_CURSOR);
|
||||
break;
|
||||
case _GHAYN_:
|
||||
cmd_pchar(GHAYN_, AT_CURSOR);
|
||||
break;
|
||||
case _IE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(IE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(IE, AT_CURSOR);
|
||||
break;
|
||||
case _YEE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(YEE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(YEE, AT_CURSOR);
|
||||
break;
|
||||
case _YE:
|
||||
if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
|
||||
cmd_pchar(YE_, AT_CURSOR);
|
||||
else
|
||||
cmd_pchar(YE, AT_CURSOR);
|
||||
}
|
||||
|
||||
switch (c)
|
||||
|
||||
@@ -3171,9 +3171,9 @@ delete_event_cb(GtkWidget *widget UNUSED,
|
||||
static int
|
||||
get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
|
||||
{
|
||||
# ifdef FEAT_GUI_GNOME
|
||||
GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
# ifdef FEAT_GUI_GNOME
|
||||
if (using_gnome && widget != NULL)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
@@ -3192,7 +3192,10 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
|
||||
item_orientation = bonobo_dock_item_get_orientation(dockitem);
|
||||
}
|
||||
}
|
||||
# else
|
||||
# define item_orientation GTK_ORIENTATION_HORIZONTAL
|
||||
# endif
|
||||
|
||||
# if GTK_CHECK_VERSION(3,0,0)
|
||||
if (widget != NULL
|
||||
&& item_orientation == orientation
|
||||
@@ -3209,16 +3212,16 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
|
||||
GtkAllocation allocation;
|
||||
|
||||
gtk_widget_get_allocation(widget, &allocation);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
return allocation.height;
|
||||
else
|
||||
return allocation.width;
|
||||
return allocation.height;
|
||||
# else
|
||||
# ifdef FEAT_GUI_GNOME
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
return widget->allocation.height;
|
||||
else
|
||||
return widget->allocation.width;
|
||||
# else
|
||||
return widget->allocation.height;
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
return 0;
|
||||
|
||||
118
src/gui_w32.c
118
src/gui_w32.c
@@ -558,13 +558,12 @@ gui_mch_set_blinking(long wait, long on, long off)
|
||||
blink_offtime = off;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static VOID CALLBACK
|
||||
_OnBlinkTimer(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
UINT uMsg UNUSED,
|
||||
UINT idEvent,
|
||||
DWORD dwTime)
|
||||
DWORD dwTime UNUSED)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
@@ -590,7 +589,7 @@ _OnBlinkTimer(
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
blink_state = BLINK_ON;
|
||||
blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime,
|
||||
(TIMERPROC)_OnBlinkTimer);
|
||||
(TIMERPROC)_OnBlinkTimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,13 +643,12 @@ gui_mch_start_blink(void)
|
||||
* Call-back routines.
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
static VOID CALLBACK
|
||||
_OnTimer(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
UINT uMsg UNUSED,
|
||||
UINT idEvent,
|
||||
DWORD dwTime)
|
||||
DWORD dwTime UNUSED)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
@@ -667,12 +665,11 @@ _OnTimer(
|
||||
s_wait_timer = 0;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnDeadChar(
|
||||
HWND hwnd,
|
||||
UINT ch,
|
||||
int cRepeat)
|
||||
HWND hwnd UNUSED,
|
||||
UINT ch UNUSED,
|
||||
int cRepeat UNUSED)
|
||||
{
|
||||
dead_key = 1;
|
||||
}
|
||||
@@ -752,12 +749,11 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
/*
|
||||
* Key hit, add it to the input buffer.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnChar(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
UINT ch,
|
||||
int cRepeat)
|
||||
int cRepeat UNUSED)
|
||||
{
|
||||
char_u string[40];
|
||||
int len = 0;
|
||||
@@ -777,12 +773,11 @@ _OnChar(
|
||||
/*
|
||||
* Alt-Key hit, add it to the input buffer.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnSysChar(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
UINT cch,
|
||||
int cRepeat)
|
||||
int cRepeat UNUSED)
|
||||
{
|
||||
char_u string[40]; /* Enough for multibyte character */
|
||||
int len;
|
||||
@@ -861,11 +856,10 @@ _OnMouseEvent(
|
||||
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnMouseButtonDown(
|
||||
HWND hwnd,
|
||||
BOOL fDoubleClick,
|
||||
HWND hwnd UNUSED,
|
||||
BOOL fDoubleClick UNUSED,
|
||||
int x,
|
||||
int y,
|
||||
UINT keyFlags)
|
||||
@@ -960,10 +954,9 @@ _OnMouseButtonDown(
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnMouseMoveOrRelease(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
int x,
|
||||
int y,
|
||||
UINT keyFlags)
|
||||
@@ -1038,13 +1031,12 @@ gui_mswin_find_menu(
|
||||
return pMenu;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnMenu(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
int id,
|
||||
HWND hwndCtl,
|
||||
UINT codeNotify)
|
||||
HWND hwndCtl UNUSED,
|
||||
UINT codeNotify UNUSED)
|
||||
{
|
||||
vimmenu_T *pMenu;
|
||||
|
||||
@@ -1527,9 +1519,8 @@ gui_mch_get_font(
|
||||
* Return the name of font "font" in allocated memory.
|
||||
* Don't know how to get the actual name, thus use the provided name.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
char_u *
|
||||
gui_mch_get_fontname(GuiFont font, char_u *name)
|
||||
gui_mch_get_fontname(GuiFont font UNUSED, char_u *name)
|
||||
{
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
@@ -2175,13 +2166,12 @@ gui_mch_enable_menu(int flag)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_set_menu_pos(
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
int x UNUSED,
|
||||
int y UNUSED,
|
||||
int w UNUSED,
|
||||
int h UNUSED)
|
||||
{
|
||||
/* It will be in the right place anyway */
|
||||
}
|
||||
@@ -2817,10 +2807,8 @@ _OnEndSession(void)
|
||||
* Get this message when the user clicks on the cross in the top right corner
|
||||
* of a Windows95 window.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnClose(
|
||||
HWND hwnd)
|
||||
_OnClose(HWND hwnd UNUSED)
|
||||
{
|
||||
gui_shell_closed();
|
||||
}
|
||||
@@ -2829,8 +2817,7 @@ _OnClose(
|
||||
* Get a message when the window is being destroyed.
|
||||
*/
|
||||
static void
|
||||
_OnDestroy(
|
||||
HWND hwnd)
|
||||
_OnDestroy(HWND hwnd)
|
||||
{
|
||||
if (!destroying)
|
||||
_OnClose(hwnd);
|
||||
@@ -2883,11 +2870,10 @@ _OnPaint(
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnSize(
|
||||
HWND hwnd,
|
||||
UINT state,
|
||||
UINT state UNUSED,
|
||||
int cx,
|
||||
int cy)
|
||||
{
|
||||
@@ -3124,9 +3110,8 @@ gui_mch_insert_lines(
|
||||
}
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_exit(int rc)
|
||||
gui_mch_exit(int rc UNUSED)
|
||||
{
|
||||
#if defined(FEAT_DIRECTX)
|
||||
DWriteContext_Close(s_dwc);
|
||||
@@ -3285,9 +3270,8 @@ gui_mch_wide_font_changed(void)
|
||||
* Initialise vim to use the font with the given name.
|
||||
* Return FAIL if the font could not be loaded, OK otherwise.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
gui_mch_init_font(char_u *font_name, int fontset)
|
||||
gui_mch_init_font(char_u *font_name, int fontset UNUSED)
|
||||
{
|
||||
LOGFONT lf;
|
||||
GuiFont font = NOFONT;
|
||||
@@ -3416,11 +3400,10 @@ gui_mch_newfont(void)
|
||||
/*
|
||||
* Set the window title
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_settitle(
|
||||
char_u *title,
|
||||
char_u *icon)
|
||||
char_u *icon UNUSED)
|
||||
{
|
||||
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
|
||||
}
|
||||
@@ -3772,10 +3755,9 @@ gui_mch_browse(
|
||||
}
|
||||
#endif /* FEAT_BROWSE */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
_OnDropFiles(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
HDROP hDrop)
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
@@ -3833,10 +3815,9 @@ _OnDropFiles(
|
||||
#endif
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
_OnScroll(
|
||||
HWND hwnd,
|
||||
HWND hwnd UNUSED,
|
||||
HWND hwndCtl,
|
||||
UINT code,
|
||||
int pos)
|
||||
@@ -3954,7 +3935,6 @@ _OnScroll(
|
||||
* Return pointer to buffer in "tofree".
|
||||
* Returns zero when out of memory.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
|
||||
{
|
||||
@@ -5588,10 +5568,14 @@ get_work_area(RECT *spi_rect)
|
||||
/*
|
||||
* Set the size of the window to the given width and height in pixels.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_set_shellsize(int width, int height,
|
||||
int min_width, int min_height, int base_width, int base_height,
|
||||
gui_mch_set_shellsize(
|
||||
int width,
|
||||
int height,
|
||||
int min_width UNUSED,
|
||||
int min_height UNUSED,
|
||||
int base_width UNUSED,
|
||||
int base_height UNUSED,
|
||||
int direction)
|
||||
{
|
||||
RECT workarea_rect;
|
||||
@@ -5752,9 +5736,8 @@ gui_mch_set_sp_color(guicolor_T color)
|
||||
/*
|
||||
* handle WM_IME_NOTIFY message
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static LRESULT
|
||||
_OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData)
|
||||
_OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED)
|
||||
{
|
||||
LRESULT lResult = 0;
|
||||
HIMC hImc;
|
||||
@@ -5802,9 +5785,8 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData)
|
||||
return lResult;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static LRESULT
|
||||
_OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param)
|
||||
_OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param)
|
||||
{
|
||||
char_u *ret;
|
||||
int len;
|
||||
@@ -6844,13 +6826,12 @@ gui_mch_menu_grey(
|
||||
* pressed, return that button's ID - IDCANCEL (2), which is the button's
|
||||
* number.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static LRESULT CALLBACK
|
||||
dialog_callback(
|
||||
HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
LPARAM lParam UNUSED)
|
||||
{
|
||||
if (message == WM_INITDIALOG)
|
||||
{
|
||||
@@ -8536,13 +8517,12 @@ delete_tooltip(BalloonEval *beval)
|
||||
PostMessage(beval->balloon, WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static VOID CALLBACK
|
||||
BevalTimerProc(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
UINT_PTR idEvent,
|
||||
DWORD dwTime)
|
||||
HWND hwnd UNUSED,
|
||||
UINT uMsg UNUSED,
|
||||
UINT_PTR idEvent UNUSED,
|
||||
DWORD dwTime)
|
||||
{
|
||||
POINT pt;
|
||||
RECT rect;
|
||||
@@ -8578,16 +8558,14 @@ BevalTimerProc(
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_disable_beval_area(BalloonEval *beval)
|
||||
gui_mch_disable_beval_area(BalloonEval *beval UNUSED)
|
||||
{
|
||||
// TRACE0("gui_mch_disable_beval_area {{{");
|
||||
KillTimer(s_textArea, BevalTimerId);
|
||||
// TRACE0("gui_mch_disable_beval_area }}}");
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
gui_mch_enable_beval_area(BalloonEval *beval)
|
||||
{
|
||||
@@ -8619,7 +8597,6 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
|
||||
// TRACE0("gui_mch_post_balloon }}}");
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
BalloonEval *
|
||||
gui_mch_create_beval_area(
|
||||
void *target, /* ignored, always use s_textArea */
|
||||
@@ -8659,9 +8636,8 @@ gui_mch_create_beval_area(
|
||||
return beval;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh)
|
||||
Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
|
||||
{
|
||||
if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */
|
||||
return;
|
||||
|
||||
@@ -1716,6 +1716,8 @@ ex_luado(exarg_T *eap)
|
||||
const char *s = (const char *) eap->arg;
|
||||
luaL_Buffer b;
|
||||
size_t len;
|
||||
buf_T *was_curbuf = curbuf;
|
||||
|
||||
if (lua_init() == FAIL) return;
|
||||
if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL)
|
||||
{
|
||||
@@ -1739,6 +1741,10 @@ ex_luado(exarg_T *eap)
|
||||
lua_replace(L, -2); /* function -> body */
|
||||
for (l = eap->line1; l <= eap->line2; l++)
|
||||
{
|
||||
/* Check the line number, the command my have deleted lines. */
|
||||
if (l > curbuf->b_ml.ml_line_count)
|
||||
break;
|
||||
|
||||
lua_pushvalue(L, -1); /* function */
|
||||
luaV_pushline(L, curbuf, l); /* current line as arg */
|
||||
lua_pushinteger(L, l); /* current line number as arg */
|
||||
@@ -1747,6 +1753,9 @@ ex_luado(exarg_T *eap)
|
||||
luaV_emsg(L);
|
||||
break;
|
||||
}
|
||||
/* Catch the command switching to another buffer. */
|
||||
if (curbuf != was_curbuf)
|
||||
break;
|
||||
if (lua_isstring(L, -1)) /* update line? */
|
||||
{
|
||||
#ifdef HAVE_SANDBOX
|
||||
|
||||
@@ -1286,6 +1286,7 @@ ex_perldo(exarg_T *eap)
|
||||
SV *sv;
|
||||
char *str;
|
||||
linenr_T i;
|
||||
buf_T *was_curbuf = curbuf;
|
||||
|
||||
if (bufempty())
|
||||
return;
|
||||
@@ -1321,11 +1322,14 @@ ex_perldo(exarg_T *eap)
|
||||
SAVETMPS;
|
||||
for (i = eap->line1; i <= eap->line2; i++)
|
||||
{
|
||||
/* Check the line number, the command my have deleted lines. */
|
||||
if (i > curbuf->b_ml.ml_line_count)
|
||||
break;
|
||||
sv_setpv(GvSV(PL_defgv), (char *)ml_get(i));
|
||||
PUSHMARK(sp);
|
||||
perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL);
|
||||
str = SvPV(GvSV(PL_errgv), length);
|
||||
if (length)
|
||||
if (length || curbuf != was_curbuf)
|
||||
break;
|
||||
SPAGAIN;
|
||||
if (SvTRUEx(POPs))
|
||||
|
||||
@@ -5619,6 +5619,7 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
int status;
|
||||
PyObject *pyfunc, *pymain;
|
||||
PyObject *run_ret;
|
||||
buf_T *was_curbuf = curbuf;
|
||||
|
||||
if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK)
|
||||
{
|
||||
@@ -5671,7 +5672,9 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
#ifdef PY_CAN_RECURSE
|
||||
*pygilstate = PyGILState_Ensure();
|
||||
#endif
|
||||
if (!(line = GetBufferLine(curbuf, lnum)))
|
||||
/* Check the line number, the command my have deleted lines. */
|
||||
if (lnum > curbuf->b_ml.ml_line_count
|
||||
|| !(line = GetBufferLine(curbuf, lnum)))
|
||||
goto err;
|
||||
if (!(linenr = PyInt_FromLong((long) lnum)))
|
||||
{
|
||||
@@ -5684,9 +5687,19 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
if (!ret)
|
||||
goto err;
|
||||
|
||||
/* Check that the command didn't switch to another buffer. */
|
||||
if (curbuf != was_curbuf)
|
||||
{
|
||||
Py_XDECREF(ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (ret != Py_None)
|
||||
if (SetBufferLine(curbuf, lnum, ret, NULL) == FAIL)
|
||||
{
|
||||
Py_XDECREF(ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
Py_XDECREF(ret);
|
||||
PythonIO_Flush();
|
||||
|
||||
@@ -783,6 +783,7 @@ void ex_rubydo(exarg_T *eap)
|
||||
{
|
||||
int state;
|
||||
linenr_T i;
|
||||
buf_T *was_curbuf = curbuf;
|
||||
|
||||
if (ensure_ruby_initialized())
|
||||
{
|
||||
@@ -792,6 +793,8 @@ void ex_rubydo(exarg_T *eap)
|
||||
{
|
||||
VALUE line;
|
||||
|
||||
if (i > curbuf->b_ml.ml_line_count)
|
||||
break;
|
||||
line = vim_str2rb_enc_str((char *)ml_get(i));
|
||||
rb_lastline_set(line);
|
||||
eval_enc_string_protect((char *) eap->arg, &state);
|
||||
@@ -800,6 +803,8 @@ void ex_rubydo(exarg_T *eap)
|
||||
error_print(state);
|
||||
break;
|
||||
}
|
||||
if (was_curbuf != curbuf)
|
||||
break;
|
||||
line = rb_lastline_get();
|
||||
if (!NIL_P(line))
|
||||
{
|
||||
|
||||
@@ -1958,6 +1958,7 @@ ex_tcldo(exarg_T *eap)
|
||||
char var_line[VARNAME_SIZE];
|
||||
linenr_T first_line = 0;
|
||||
linenr_T last_line = 0;
|
||||
buf_T *was_curbuf = curbuf;
|
||||
|
||||
rs = eap->line1;
|
||||
re = eap->line2;
|
||||
@@ -1979,6 +1980,8 @@ ex_tcldo(exarg_T *eap)
|
||||
}
|
||||
while (err == TCL_OK && rs <= re)
|
||||
{
|
||||
if ((linenr_T)rs > curbuf->b_ml.ml_line_count)
|
||||
break;
|
||||
line = (char *)ml_get_buf(curbuf, (linenr_T)rs, FALSE);
|
||||
if (!line)
|
||||
{
|
||||
@@ -1994,7 +1997,7 @@ ex_tcldo(exarg_T *eap)
|
||||
#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
|
||||
|| Tcl_LimitExceeded(tclinfo.interp)
|
||||
#endif
|
||||
)
|
||||
|| curbuf != was_curbuf)
|
||||
break;
|
||||
line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
|
||||
if (line)
|
||||
|
||||
@@ -4453,9 +4453,6 @@ vim_setenv(char_u *name, char_u *val)
|
||||
{
|
||||
sprintf((char *)envbuf, "%s=%s", name, val);
|
||||
putenv((char *)envbuf);
|
||||
# ifdef libintl_putenv
|
||||
libintl_putenv((char *)envbuf);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_GETTEXT
|
||||
|
||||
@@ -2041,6 +2041,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
||||
|
||||
if (restart_edit == 0)
|
||||
restart_edit = restart_edit_save;
|
||||
else
|
||||
cap->retval |= CA_COMMAND_BUSY;
|
||||
}
|
||||
#else
|
||||
vim_beep(BO_OPER);
|
||||
|
||||
@@ -2571,7 +2571,8 @@ op_insert(oparg_T *oap, long count1)
|
||||
}
|
||||
|
||||
t1 = oap->start;
|
||||
edit(NUL, FALSE, (linenr_T)count1);
|
||||
if (edit(NUL, FALSE, (linenr_T)count1))
|
||||
return;
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -306,10 +306,8 @@ mch_settitle(
|
||||
* 2: Just restore icon (which we don't have)
|
||||
* 3: Restore title and icon (which we don't have)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_restore_title(
|
||||
int which)
|
||||
mch_restore_title(int which UNUSED)
|
||||
{
|
||||
#ifndef FEAT_GUI_MSWIN
|
||||
SetConsoleTitle(g_szOrigTitle);
|
||||
@@ -345,13 +343,12 @@ mch_can_restore_icon(void)
|
||||
* When 'shellslash' set do it the other way around.
|
||||
* Return OK or FAIL.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mch_FullName(
|
||||
char_u *fname,
|
||||
char_u *buf,
|
||||
int len,
|
||||
int force)
|
||||
int force UNUSED)
|
||||
{
|
||||
int nResult = FAIL;
|
||||
|
||||
@@ -636,9 +633,8 @@ vim_stat(const char *name, stat_T *stp)
|
||||
}
|
||||
|
||||
#if defined(FEAT_GUI_MSWIN) || defined(PROTO)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_settmode(int tmode)
|
||||
mch_settmode(int tmode UNUSED)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
@@ -817,10 +813,8 @@ mch_char_avail(void)
|
||||
/*
|
||||
* set screen mode, always fails.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mch_screenmode(
|
||||
char_u *arg)
|
||||
mch_screenmode(char_u *arg UNUSED)
|
||||
{
|
||||
EMSG(_(e_screenmode));
|
||||
return FAIL;
|
||||
@@ -996,10 +990,8 @@ mch_libcall(
|
||||
/*
|
||||
* Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
DumpPutS(
|
||||
const char *psz)
|
||||
DumpPutS(const char *psz UNUSED)
|
||||
{
|
||||
# ifdef MCH_WRITE_DUMP
|
||||
if (fdDump)
|
||||
@@ -1173,9 +1165,12 @@ swap_me(COLORREF colorref)
|
||||
# define PDP_RETVAL INT_PTR
|
||||
#endif
|
||||
|
||||
/*ARGSUSED*/
|
||||
static PDP_RETVAL CALLBACK
|
||||
PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
PrintDlgProc(
|
||||
HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam UNUSED,
|
||||
LPARAM lParam UNUSED)
|
||||
{
|
||||
#ifdef FEAT_GETTEXT
|
||||
NONCLIENTMETRICS nm;
|
||||
@@ -1236,9 +1231,8 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static BOOL CALLBACK
|
||||
AbortProc(HDC hdcPrn, int iCode)
|
||||
AbortProc(HDC hdcPrn UNUSED, int iCode UNUSED)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
@@ -1683,9 +1677,8 @@ mch_print_begin(prt_settings_T *psettings)
|
||||
return (ret > 0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_print_end(prt_settings_T *psettings)
|
||||
mch_print_end(prt_settings_T *psettings UNUSED)
|
||||
{
|
||||
EndDoc(prt_dlg.hDC);
|
||||
if (!*bUserAbort)
|
||||
@@ -2764,12 +2757,11 @@ points_to_pixels(char_u *str, char_u **end, int vertical, long_i pprinter_dc)
|
||||
return pixels;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int CALLBACK
|
||||
font_enumproc(
|
||||
ENUMLOGFONT *elf,
|
||||
NEWTEXTMETRIC *ntm,
|
||||
int type,
|
||||
NEWTEXTMETRIC *ntm UNUSED,
|
||||
int type UNUSED,
|
||||
LPARAM lparam)
|
||||
{
|
||||
/* Return value:
|
||||
|
||||
@@ -38,13 +38,12 @@ void _cdecl SaveInst(HINSTANCE hInst);
|
||||
static void (_cdecl *pSaveInst)(HINSTANCE);
|
||||
#endif
|
||||
|
||||
/*ARGSUSED*/
|
||||
int WINAPI
|
||||
WinMain(
|
||||
HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInst,
|
||||
HINSTANCE hInstance UNUSED,
|
||||
HINSTANCE hPrevInst UNUSED,
|
||||
LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
int nCmdShow UNUSED)
|
||||
{
|
||||
int argc = 0;
|
||||
char **argv;
|
||||
|
||||
103
src/os_win32.c
103
src/os_win32.c
@@ -515,6 +515,7 @@ static char *null_libintl_textdomain(const char *);
|
||||
static char *null_libintl_bindtextdomain(const char *, const char *);
|
||||
static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
|
||||
static int null_libintl_putenv(const char *);
|
||||
static int null_libintl_wputenv(const wchar_t *);
|
||||
|
||||
static HINSTANCE hLibintlDLL = NULL;
|
||||
char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
|
||||
@@ -526,6 +527,7 @@ char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
|
||||
char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *)
|
||||
= null_libintl_bind_textdomain_codeset;
|
||||
int (*dyn_libintl_putenv)(const char *) = null_libintl_putenv;
|
||||
int (*dyn_libintl_wputenv)(const wchar_t *) = null_libintl_wputenv;
|
||||
|
||||
int
|
||||
dyn_libintl_init(void)
|
||||
@@ -591,9 +593,14 @@ dyn_libintl_init(void)
|
||||
/* _putenv() function for the libintl.dll is optional. */
|
||||
hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
|
||||
if (hmsvcrt != NULL)
|
||||
{
|
||||
dyn_libintl_putenv = (void *)GetProcAddress(hmsvcrt, "_putenv");
|
||||
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == putenv)
|
||||
dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv");
|
||||
}
|
||||
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == _putenv)
|
||||
dyn_libintl_putenv = null_libintl_putenv;
|
||||
if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
|
||||
dyn_libintl_wputenv = null_libintl_wputenv;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -610,16 +617,15 @@ dyn_libintl_end(void)
|
||||
dyn_libintl_bindtextdomain = null_libintl_bindtextdomain;
|
||||
dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset;
|
||||
dyn_libintl_putenv = null_libintl_putenv;
|
||||
dyn_libintl_wputenv = null_libintl_wputenv;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static char *
|
||||
null_libintl_gettext(const char *msgid)
|
||||
{
|
||||
return (char*)msgid;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static char *
|
||||
null_libintl_ngettext(
|
||||
const char *msgid,
|
||||
@@ -629,31 +635,36 @@ null_libintl_ngettext(
|
||||
return (char *)(n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static char *
|
||||
null_libintl_bindtextdomain(const char *domainname, const char *dirname)
|
||||
null_libintl_bindtextdomain(
|
||||
const char *domainname UNUSED,
|
||||
const char *dirname UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static char *
|
||||
null_libintl_bind_textdomain_codeset(const char *domainname,
|
||||
const char *codeset)
|
||||
null_libintl_bind_textdomain_codeset(
|
||||
const char *domainname UNUSED,
|
||||
const char *codeset UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static char *
|
||||
null_libintl_textdomain(const char *domainname)
|
||||
null_libintl_textdomain(const char *domainname UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
null_libintl_putenv(const char *envstring)
|
||||
null_libintl_putenv(const char *envstring UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
null_libintl_wputenv(const wchar_t *envstring UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1045,9 +1056,8 @@ decode_key_event(
|
||||
* For the GUI the mouse handling is in gui_w32.c.
|
||||
*/
|
||||
# ifdef FEAT_GUI_W32
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_setmouse(int on)
|
||||
mch_setmouse(int on UNUSED)
|
||||
{
|
||||
}
|
||||
# else
|
||||
@@ -1643,13 +1653,12 @@ tgetch(int *pmodifiers, WCHAR *pch2)
|
||||
* If time == -1, wait forever for characters.
|
||||
* Returns the number of characters read into buf.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mch_inchar(
|
||||
char_u *buf,
|
||||
int maxlen,
|
||||
long time,
|
||||
int tb_change_cnt)
|
||||
char_u *buf UNUSED,
|
||||
int maxlen UNUSED,
|
||||
long time UNUSED,
|
||||
int tb_change_cnt UNUSED)
|
||||
{
|
||||
#ifndef FEAT_GUI_W32 /* this isn't used for the GUI */
|
||||
|
||||
@@ -2577,11 +2586,10 @@ mch_exit(int r)
|
||||
/*
|
||||
* Do we have an interactive window?
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mch_check_win(
|
||||
int argc,
|
||||
char **argv)
|
||||
int argc UNUSED,
|
||||
char **argv UNUSED)
|
||||
{
|
||||
get_exe_name();
|
||||
|
||||
@@ -5333,11 +5341,10 @@ termcap_mode_end(void)
|
||||
|
||||
|
||||
#ifdef FEAT_GUI_W32
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_write(
|
||||
char_u *s,
|
||||
int len)
|
||||
char_u *s UNUSED,
|
||||
int len UNUSED)
|
||||
{
|
||||
/* never used */
|
||||
}
|
||||
@@ -6035,11 +6042,10 @@ mch_write(
|
||||
/*
|
||||
* Delay for "msec" milliseconds.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mch_delay(
|
||||
long msec,
|
||||
int ignoreinput)
|
||||
int ignoreinput UNUSED)
|
||||
{
|
||||
#ifdef FEAT_GUI_W32
|
||||
Sleep((int)msec); /* never wait for input */
|
||||
@@ -6128,9 +6134,8 @@ mch_breakcheck(int force)
|
||||
/*
|
||||
* How much main memory in KiB that can be used by VIM.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
long_u
|
||||
mch_total_mem(int special)
|
||||
mch_total_mem(int special UNUSED)
|
||||
{
|
||||
MEMORYSTATUSEX ms;
|
||||
|
||||
@@ -6985,3 +6990,43 @@ fix_arg_enc(void)
|
||||
set_alist_count();
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
mch_setenv(char *var, char *value, int x)
|
||||
{
|
||||
char_u *envbuf;
|
||||
|
||||
envbuf = alloc((unsigned)(STRLEN(var) + STRLEN(value) + 2));
|
||||
if (envbuf == NULL)
|
||||
return -1;
|
||||
|
||||
sprintf((char *)envbuf, "%s=%s", var, value);
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_utf16(envbuf, NULL);
|
||||
|
||||
vim_free(envbuf);
|
||||
if (p == NULL)
|
||||
return -1;
|
||||
_wputenv(p);
|
||||
# ifdef libintl_wputenv
|
||||
libintl_wputenv(p);
|
||||
# endif
|
||||
/* Unlike Un*x systems, we can free the string for _wputenv(). */
|
||||
vim_free(p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
_putenv((char *)envbuf);
|
||||
# ifdef libintl_putenv
|
||||
libintl_putenv((char *)envbuf);
|
||||
# endif
|
||||
/* Unlike Un*x systems, we can free the string for _putenv(). */
|
||||
vim_free(envbuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,9 @@ Trace(char *pszFormat, ...);
|
||||
#define ASSERT_NULL_OR_POINTER(p, type) \
|
||||
ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
|
||||
|
||||
#define mch_setenv(name, val, x) setenv(name, val, x)
|
||||
#ifndef HAVE_SETENV
|
||||
# define HAVE_SETENV
|
||||
#endif
|
||||
#define mch_getenv(x) (char_u *)getenv((char *)(x))
|
||||
#ifdef __BORLANDC__
|
||||
# define vim_mkdir(x, y) mkdir(x)
|
||||
|
||||
@@ -65,4 +65,5 @@ void free_cmd_argsW(void);
|
||||
void used_file_arg(char *name, int literal, int full_path, int diff_mode);
|
||||
void set_alist_count(void);
|
||||
void fix_arg_enc(void);
|
||||
int mch_setenv(char *var, char *value, int x);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
177
src/screen.c
177
src/screen.c
@@ -777,101 +777,7 @@ update_screen(int type)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FEAT_CONCEAL) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
||||
* to the 'concealcursor' option.
|
||||
*/
|
||||
int
|
||||
conceal_cursor_line(win_T *wp)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (*wp->w_p_cocu == NUL)
|
||||
return FALSE;
|
||||
if (get_real_state() & VISUAL)
|
||||
c = 'v';
|
||||
else if (State & INSERT)
|
||||
c = 'i';
|
||||
else if (State & NORMAL)
|
||||
c = 'n';
|
||||
else if (State & CMDLINE)
|
||||
c = 'c';
|
||||
else
|
||||
return FALSE;
|
||||
return vim_strchr(wp->w_p_cocu, c) != NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the cursor line needs to be redrawn because of 'concealcursor'.
|
||||
*/
|
||||
void
|
||||
conceal_check_cursur_line(void)
|
||||
{
|
||||
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin))
|
||||
{
|
||||
need_cursor_line_redraw = TRUE;
|
||||
/* Need to recompute cursor column, e.g., when starting Visual mode
|
||||
* without concealing. */
|
||||
curs_columns(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
update_single_line(win_T *wp, linenr_T lnum)
|
||||
{
|
||||
int row;
|
||||
int j;
|
||||
|
||||
/* Don't do anything if the screen structures are (not yet) valid. */
|
||||
if (!screen_valid(TRUE))
|
||||
return;
|
||||
|
||||
if (lnum >= wp->w_topline && lnum < wp->w_botline
|
||||
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
|
||||
{
|
||||
# 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
|
||||
row = 0;
|
||||
for (j = 0; j < wp->w_lines_valid; ++j)
|
||||
{
|
||||
if (lnum == wp->w_lines[j].wl_lnum)
|
||||
{
|
||||
screen_start(); /* not sure of screen cursor */
|
||||
# ifdef FEAT_SEARCH_EXTRA
|
||||
init_search_hl(wp);
|
||||
start_search_hl();
|
||||
prepare_search_hl(wp, lnum);
|
||||
# endif
|
||||
win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE);
|
||||
# if defined(FEAT_SEARCH_EXTRA)
|
||||
end_search_hl();
|
||||
# endif
|
||||
break;
|
||||
}
|
||||
row += wp->w_lines[j].wl_size;
|
||||
}
|
||||
# ifdef FEAT_GUI
|
||||
/* Redraw the cursor */
|
||||
if (gui.in_use)
|
||||
{
|
||||
out_flush(); /* required before updating the cursor */
|
||||
gui_update_cursor(FALSE, FALSE);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
need_cursor_line_redraw = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_SIGNS) || defined(FEAT_GUI)
|
||||
static void update_prepare(void);
|
||||
static void update_finish(void);
|
||||
|
||||
#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.
|
||||
@@ -922,6 +828,87 @@ update_finish(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_CONCEAL) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
||||
* to the 'concealcursor' option.
|
||||
*/
|
||||
int
|
||||
conceal_cursor_line(win_T *wp)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (*wp->w_p_cocu == NUL)
|
||||
return FALSE;
|
||||
if (get_real_state() & VISUAL)
|
||||
c = 'v';
|
||||
else if (State & INSERT)
|
||||
c = 'i';
|
||||
else if (State & NORMAL)
|
||||
c = 'n';
|
||||
else if (State & CMDLINE)
|
||||
c = 'c';
|
||||
else
|
||||
return FALSE;
|
||||
return vim_strchr(wp->w_p_cocu, c) != NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the cursor line needs to be redrawn because of 'concealcursor'.
|
||||
*/
|
||||
void
|
||||
conceal_check_cursur_line(void)
|
||||
{
|
||||
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin))
|
||||
{
|
||||
need_cursor_line_redraw = TRUE;
|
||||
/* Need to recompute cursor column, e.g., when starting Visual mode
|
||||
* without concealing. */
|
||||
curs_columns(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
update_single_line(win_T *wp, linenr_T lnum)
|
||||
{
|
||||
int row;
|
||||
int j;
|
||||
|
||||
/* Don't do anything if the screen structures are (not yet) valid. */
|
||||
if (!screen_valid(TRUE) || updating_screen)
|
||||
return;
|
||||
|
||||
if (lnum >= wp->w_topline && lnum < wp->w_botline
|
||||
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
|
||||
{
|
||||
update_prepare();
|
||||
|
||||
row = 0;
|
||||
for (j = 0; j < wp->w_lines_valid; ++j)
|
||||
{
|
||||
if (lnum == wp->w_lines[j].wl_lnum)
|
||||
{
|
||||
screen_start(); /* not sure of screen cursor */
|
||||
# ifdef FEAT_SEARCH_EXTRA
|
||||
init_search_hl(wp);
|
||||
start_search_hl();
|
||||
prepare_search_hl(wp, lnum);
|
||||
# endif
|
||||
win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE);
|
||||
# if defined(FEAT_SEARCH_EXTRA)
|
||||
end_search_hl();
|
||||
# endif
|
||||
break;
|
||||
}
|
||||
row += wp->w_lines[j].wl_size;
|
||||
}
|
||||
|
||||
update_finish();
|
||||
}
|
||||
need_cursor_line_redraw = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_SIGNS) || defined(PROTO)
|
||||
void
|
||||
update_debug_sign(buf_T *buf, linenr_T lnum)
|
||||
|
||||
@@ -164,6 +164,7 @@ NEW_TESTS = test_arglist.res \
|
||||
test_job_fails.res \
|
||||
test_json.res \
|
||||
test_langmap.res \
|
||||
test_lua.res \
|
||||
test_man.res \
|
||||
test_marks.res \
|
||||
test_matchadd_conceal.res \
|
||||
@@ -172,10 +173,12 @@ NEW_TESTS = test_arglist.res \
|
||||
test_nested_function.res \
|
||||
test_netbeans.res \
|
||||
test_normal.res \
|
||||
test_paste.res \
|
||||
test_packadd.res \
|
||||
test_paste.res \
|
||||
test_perl.res \
|
||||
test_profile.res \
|
||||
test_python2.res \
|
||||
test_python3.res \
|
||||
test_pyx2.res \
|
||||
test_pyx3.res \
|
||||
test_quickfix.res \
|
||||
@@ -190,6 +193,7 @@ NEW_TESTS = test_arglist.res \
|
||||
test_substitute.res \
|
||||
test_syntax.res \
|
||||
test_system.res \
|
||||
test_tcl.res \
|
||||
test_textobjects.res \
|
||||
test_undo.res \
|
||||
test_usercommands.res \
|
||||
|
||||
@@ -78,7 +78,7 @@ test1.out: test1.in
|
||||
# 200 msec is sufficient, but only modern sleep supports a fraction of
|
||||
# a second, fall back to a second if it fails.
|
||||
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
||||
-$(RUN_VIM) $*.in
|
||||
$(RUN_VIM) $*.in
|
||||
|
||||
# For flaky tests retry one time. No tests at the moment.
|
||||
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
|
||||
@@ -108,7 +108,7 @@ bench_re_freeze.out: bench_re_freeze.vim
|
||||
# 200 msec is sufficient, but only modern sleep supports a fraction of
|
||||
# a second, fall back to a second if it fails.
|
||||
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
||||
-$(RUN_VIM) $*.in
|
||||
$(RUN_VIM) $*.in
|
||||
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
|
||||
|
||||
nolog:
|
||||
|
||||
@@ -153,11 +153,13 @@ endif
|
||||
|
||||
" Names of flaky tests.
|
||||
let s:flaky = [
|
||||
\ 'Test_reltime()',
|
||||
\ 'Test_nb_basic()',
|
||||
\ 'Test_close_and_exit_cb()',
|
||||
\ 'Test_collapse_buffers()',
|
||||
\ 'Test_communicate()',
|
||||
\ 'Test_nb_basic()',
|
||||
\ 'Test_pipe_through_sort_all()',
|
||||
\ 'Test_pipe_through_sort_some()'
|
||||
\ 'Test_reltime()',
|
||||
\ ]
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" Simplistic testing of Farsi mode.
|
||||
" Note: must be edited with latin1 encoding.
|
||||
|
||||
if !has('farsi')
|
||||
finish
|
||||
@@ -82,3 +83,51 @@ func Test_farsi_map()
|
||||
set noaltkeymap
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_input_farsi()
|
||||
new
|
||||
setlocal rightleft fkmap
|
||||
" numbers switch input direction
|
||||
call feedkeys("aabc0123456789.+-^%#=xyz\<Esc>", 'tx')
|
||||
call assert_equal("\x8c<38>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\x93<39>", getline('.'))
|
||||
|
||||
" all non-number special chars with spaces
|
||||
call feedkeys("oB E F H I K L M O P Q R T U W Y ` ! @ # $ % ^ & * () - _ = + \\ | : \" . / < > ? \<Esc>", 'tx')
|
||||
call assert_equal("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B>]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F1A0A2A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>蠨<EFBFBD><E8A0A8><EFBFBD><EFBFBD>頽<EFBFBD><E9A0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getline('.'))
|
||||
|
||||
" all non-number special chars without spaces
|
||||
call feedkeys("oBEFHIKLMOPQRTUWY`!@#$%^&*()-_=+\\|:\"./<>?\<Esc>",'tx')
|
||||
call assert_equal("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F1A2A3A7><EFBFBD><EFBFBD><EFBFBD>訩<EFBFBD>齫<EFBFBD>꺻<EFBFBD><EABABB><EFBFBD><EFBFBD><EFBFBD>", getline('.'))
|
||||
|
||||
" all letter chars with spaces
|
||||
call feedkeys("oa A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \ , [ ] \<Esc>", 'tx')
|
||||
call assert_equal("Ѡ<><D1A0>̠ΠϠ<CEA0><CFA0><EFBFBD><EFBFBD>Ơàܠ<C3A0><DCA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Š<EFBFBD><C5A0>ޠݠĠˠˠʠɠӠ٠Р<D9A0><D0A0>ؠ֠͠͠ҠԠԠנՠ<D7A0><D5A0>ڠ<EFBFBD>ߠǠȠ", getline('.'))
|
||||
|
||||
" all letter chars without spaces
|
||||
call feedkeys("oaAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\,[]\<Esc>", 'tx')
|
||||
call assert_equal("\x8c<38><63><EFBFBD><EFBFBD>\x9f<39>\x86\x83<38><33><EFBFBD>\x9d\x85\x80\x9c\x9b\x84<38><34>\x8a\x89\x8e\x96\x8b<38>\x95\x90<39><30>\x8d<38><64>\x93<39><33>\x97<39>\x87\x88", getline('.'))
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_command_line_farsi()
|
||||
set allowrevins altkeymap
|
||||
|
||||
" letter characters with spaces
|
||||
call feedkeys(":\"\<C-_>a A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \\ , [ ]\<CR>", 'tx')
|
||||
call assert_equal("\"\x88<38>Ǡߠ<C7A0><DFA0>ڠՠՠנԠԠҠ֠͠͠ؠ<D6A0><D8A0>Р٠ӠɠʠˠˠĠݠޠ<DDA0><DEA0>Š<EFBFBD><C5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܠàƠ<C3A0><C6A0><EFBFBD><EFBFBD>ϠΠ̠<CEA0><CCA0><EFBFBD>", getreg(':'))
|
||||
|
||||
" letter characters without spaces
|
||||
call feedkeys(":\"\<C-_>aAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\\,[]\<CR>", 'tx')
|
||||
call assert_equal("\"\x88\x87<38><37><EFBFBD><EFBFBD><EFBFBD>\x93<39><33>\x8d<38><64>\x90\x95<39>\x8b\x96\x8e\x89\x8a<38><61>\x84\x9b\x9c\x80\x85\x9d<39><64><EFBFBD>\x83\x86<38>\x9f<39><66><EFBFBD><EFBFBD>\x8c", getreg(':'))
|
||||
|
||||
" other characters with spaces
|
||||
call feedkeys(":\"\<C-_>0 1 2 3 4 5 6 7 8 9 ` . ! \" $ % ^ & / () = \\ ? + - _ * : # ~ @ < > { } | B E F H I K L M O P Q R T U W Y\<CR>", 'tx')
|
||||
call assert_equal("\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]<5D>[<5B> <EFBFBD><C2A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}<7D>{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>頭<EFBFBD><E9A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>렽<EFBFBD><EBA0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getreg(':'))
|
||||
|
||||
" other characters without spaces
|
||||
call feedkeys(":\"\<C-_>0123456789`.!\"$%^&/()=\\?+-_*:#~@<>{}|BEFHIKLMOPQRTUWY\<CR>", 'tx')
|
||||
call assert_equal("\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>][<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}{<7B><><EFBFBD>~<7E><><EFBFBD>魫<EFBFBD>뽩<EFBFBD><EBBDA9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getreg(':'))
|
||||
|
||||
set noallowrevins noaltkeymap
|
||||
endfunc
|
||||
|
||||
@@ -1,5 +1,78 @@
|
||||
" Tests for various functions.
|
||||
|
||||
func Test_empty()
|
||||
call assert_equal(1, empty(''))
|
||||
call assert_equal(0, empty('a'))
|
||||
|
||||
call assert_equal(1, empty(0))
|
||||
call assert_equal(1, empty(-0))
|
||||
call assert_equal(0, empty(1))
|
||||
call assert_equal(0, empty(-1))
|
||||
|
||||
call assert_equal(1, empty(0.0))
|
||||
call assert_equal(1, empty(-0.0))
|
||||
call assert_equal(0, empty(1.0))
|
||||
call assert_equal(0, empty(-1.0))
|
||||
call assert_equal(0, empty(1.0/0.0))
|
||||
call assert_equal(0, empty(0.0/0.0))
|
||||
|
||||
call assert_equal(1, empty([]))
|
||||
call assert_equal(0, empty(['a']))
|
||||
|
||||
call assert_equal(1, empty({}))
|
||||
call assert_equal(0, empty({'a':1}))
|
||||
|
||||
call assert_equal(1, empty(v:null))
|
||||
call assert_equal(1, empty(v:none))
|
||||
call assert_equal(1, empty(v:false))
|
||||
call assert_equal(0, empty(v:true))
|
||||
|
||||
call assert_equal(0, empty(function('Test_empty')))
|
||||
endfunc
|
||||
|
||||
func Test_len()
|
||||
call assert_equal(1, len(0))
|
||||
call assert_equal(2, len(12))
|
||||
|
||||
call assert_equal(0, len(''))
|
||||
call assert_equal(2, len('ab'))
|
||||
|
||||
call assert_equal(0, len([]))
|
||||
call assert_equal(2, len([2, 1]))
|
||||
|
||||
call assert_equal(0, len({}))
|
||||
call assert_equal(2, len({'a': 1, 'b': 2}))
|
||||
|
||||
call assert_fails('call len(v:none)', 'E701:')
|
||||
call assert_fails('call len({-> 0})', 'E701:')
|
||||
endfunc
|
||||
|
||||
func Test_max()
|
||||
call assert_equal(0, max([]))
|
||||
call assert_equal(2, max([2]))
|
||||
call assert_equal(2, max([1, 2]))
|
||||
call assert_equal(2, max([1, 2, v:null]))
|
||||
|
||||
call assert_equal(0, max({}))
|
||||
call assert_equal(2, max({'a':1, 'b':2}))
|
||||
|
||||
call assert_fails('call max(1)', 'E712:')
|
||||
call assert_fails('call max(v:none)', 'E712:')
|
||||
endfunc
|
||||
|
||||
func Test_min()
|
||||
call assert_equal(0, min([]))
|
||||
call assert_equal(2, min([2]))
|
||||
call assert_equal(1, min([1, 2]))
|
||||
call assert_equal(0, min([1, 2, v:null]))
|
||||
|
||||
call assert_equal(0, min({}))
|
||||
call assert_equal(1, min({'a':1, 'b':2}))
|
||||
|
||||
call assert_fails('call min(1)', 'E712:')
|
||||
call assert_fails('call min(v:none)', 'E712:')
|
||||
endfunc
|
||||
|
||||
func Test_str2nr()
|
||||
call assert_equal(0, str2nr(''))
|
||||
call assert_equal(1, str2nr('1'))
|
||||
@@ -15,6 +88,77 @@ func Test_str2nr()
|
||||
|
||||
call assert_equal(123456789, str2nr('123456789'))
|
||||
call assert_equal(-123456789, str2nr('-123456789'))
|
||||
|
||||
call assert_equal(5, str2nr('101', 2))
|
||||
call assert_equal(5, str2nr('0b101', 2))
|
||||
call assert_equal(5, str2nr('0B101', 2))
|
||||
call assert_equal(-5, str2nr('-101', 2))
|
||||
call assert_equal(-5, str2nr('-0b101', 2))
|
||||
call assert_equal(-5, str2nr('-0B101', 2))
|
||||
|
||||
call assert_equal(65, str2nr('101', 8))
|
||||
call assert_equal(65, str2nr('0101', 8))
|
||||
call assert_equal(-65, str2nr('-101', 8))
|
||||
call assert_equal(-65, str2nr('-0101', 8))
|
||||
|
||||
call assert_equal(11259375, str2nr('abcdef', 16))
|
||||
call assert_equal(11259375, str2nr('ABCDEF', 16))
|
||||
call assert_equal(-11259375, str2nr('-ABCDEF', 16))
|
||||
call assert_equal(11259375, str2nr('0xabcdef', 16))
|
||||
call assert_equal(11259375, str2nr('0Xabcdef', 16))
|
||||
call assert_equal(11259375, str2nr('0XABCDEF', 16))
|
||||
call assert_equal(-11259375, str2nr('-0xABCDEF', 16))
|
||||
|
||||
call assert_equal(0, str2nr('0x10'))
|
||||
call assert_equal(0, str2nr('0b10'))
|
||||
call assert_equal(1, str2nr('12', 2))
|
||||
call assert_equal(1, str2nr('18', 8))
|
||||
call assert_equal(1, str2nr('1g', 16))
|
||||
|
||||
call assert_equal(0, str2nr(v:null))
|
||||
call assert_equal(0, str2nr(v:none))
|
||||
|
||||
call assert_fails('call str2nr([])', 'E730:')
|
||||
call assert_fails('call str2nr({->2})', 'E729:')
|
||||
call assert_fails('call str2nr(1.2)', 'E806:')
|
||||
call assert_fails('call str2nr(10, [])', 'E474:')
|
||||
endfunc
|
||||
|
||||
func Test_strftime()
|
||||
if !exists('*strftime')
|
||||
return
|
||||
endif
|
||||
" Format of strftime() depends on system. We assume
|
||||
" that basic formats tested here are available and
|
||||
" identical on all systems which support strftime().
|
||||
"
|
||||
" The 2nd parameter of strftime() is a local time, so the output day
|
||||
" of strftime() can be 17 or 18, depending on timezone.
|
||||
call assert_match('^2017-01-1[78]$', strftime('%Y-%m-%d', 1484695512))
|
||||
"
|
||||
call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', strftime('%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
call assert_fails('call strftime([])', 'E730:')
|
||||
call assert_fails('call strftime("%Y", [])', 'E745:')
|
||||
endfunc
|
||||
|
||||
func Test_simplify()
|
||||
call assert_equal('', simplify(''))
|
||||
call assert_equal('/', simplify('/'))
|
||||
call assert_equal('/', simplify('/.'))
|
||||
call assert_equal('/', simplify('/..'))
|
||||
call assert_equal('/...', simplify('/...'))
|
||||
call assert_equal('./dir/file', simplify('./dir/file'))
|
||||
call assert_equal('./dir/file', simplify('.///dir//file'))
|
||||
call assert_equal('./dir/file', simplify('./dir/./file'))
|
||||
call assert_equal('./file', simplify('./dir/../file'))
|
||||
call assert_equal('../dir/file', simplify('dir/../../dir/file'))
|
||||
call assert_equal('./file', simplify('dir/.././file'))
|
||||
|
||||
call assert_fails('call simplify({->0})', 'E729:')
|
||||
call assert_fails('call simplify([])', 'E730:')
|
||||
call assert_fails('call simplify({})', 'E731:')
|
||||
call assert_fails('call simplify(1.2)', 'E806:')
|
||||
endfunc
|
||||
|
||||
func Test_tolower()
|
||||
@@ -157,7 +301,92 @@ func Test_toupper()
|
||||
call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ"))
|
||||
call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ"))
|
||||
|
||||
call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ"))
|
||||
call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ"))
|
||||
endfunc
|
||||
|
||||
" Tests for the mode() function
|
||||
let current_modes = ''
|
||||
func! Save_mode()
|
||||
let g:current_modes = mode(0) . '-' . mode(1)
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
func! Test_mode()
|
||||
new
|
||||
call append(0, ["Blue Ball Black", "Brown Band Bowl", ""])
|
||||
|
||||
inoremap <F2> <C-R>=Save_mode()<CR>
|
||||
|
||||
normal! 3G
|
||||
exe "normal i\<F2>\<Esc>"
|
||||
call assert_equal('i-i', g:current_modes)
|
||||
exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iBro\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iBa\<C-X>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ix', g:current_modes)
|
||||
exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iCom\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
|
||||
exe "normal RBa\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RBro\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RBa\<C-X>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rx', g:current_modes)
|
||||
exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RCom\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
|
||||
call assert_equal('n', mode(0))
|
||||
call assert_equal('n', mode(1))
|
||||
|
||||
" How to test operator-pending mode?
|
||||
|
||||
call feedkeys("v", 'xt')
|
||||
call assert_equal('v', mode())
|
||||
call assert_equal('v', mode(1))
|
||||
call feedkeys("\<Esc>V", 'xt')
|
||||
call assert_equal('V', mode())
|
||||
call assert_equal('V', mode(1))
|
||||
call feedkeys("\<Esc>\<C-V>", 'xt')
|
||||
call assert_equal("\<C-V>", mode())
|
||||
call assert_equal("\<C-V>", mode(1))
|
||||
call feedkeys("\<Esc>", 'xt')
|
||||
|
||||
call feedkeys("gh", 'xt')
|
||||
call assert_equal('s', mode())
|
||||
call assert_equal('s', mode(1))
|
||||
call feedkeys("\<Esc>gH", 'xt')
|
||||
call assert_equal('S', mode())
|
||||
call assert_equal('S', mode(1))
|
||||
call feedkeys("\<Esc>g\<C-H>", 'xt')
|
||||
call assert_equal("\<C-S>", mode())
|
||||
call assert_equal("\<C-S>", mode(1))
|
||||
call feedkeys("\<Esc>", 'xt')
|
||||
|
||||
call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt')
|
||||
call assert_equal('c-c', g:current_modes)
|
||||
call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
|
||||
call assert_equal('c-cv', g:current_modes)
|
||||
" How to test Ex mode?
|
||||
|
||||
bwipe!
|
||||
iunmap <F2>
|
||||
endfunc
|
||||
|
||||
@@ -10,7 +10,12 @@ func SetUp()
|
||||
set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
|
||||
endif
|
||||
|
||||
" Gnome insists on creating $HOME/.gnome2/..
|
||||
" Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
|
||||
" actual home directory. But avoid triggering fontconfig by setting the
|
||||
" cache directory. Only needed for Unix.
|
||||
if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
|
||||
let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
|
||||
endif
|
||||
call mkdir('Xhome')
|
||||
let $HOME = fnamemodify('Xhome', ':p')
|
||||
endfunc
|
||||
|
||||
22
src/testdir/test_lua.vim
Normal file
22
src/testdir/test_lua.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" Tests for Lua.
|
||||
" TODO: move tests from test85.in here.
|
||||
|
||||
if !has('lua')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_luado()
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
luado vim.command("%d_")
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
luado vim.command("new")
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
@@ -110,6 +110,8 @@ func Test_map_langmap()
|
||||
call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
|
||||
call assert_equal('+', getline('$'))
|
||||
|
||||
iunmap a
|
||||
iunmap c
|
||||
set nomodified
|
||||
endfunc
|
||||
|
||||
@@ -120,7 +122,7 @@ func Test_map_feedkeys()
|
||||
$-1
|
||||
call feedkeys("0qqdw.ifoo\<Esc>qj0@q\<Esc>", "xt")
|
||||
call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$')))
|
||||
unmap .
|
||||
nunmap .
|
||||
set nomodified
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -82,6 +82,21 @@ function Test_perldo()
|
||||
1
|
||||
call assert_false(search('\Cperl'))
|
||||
bw!
|
||||
|
||||
" Check deleting lines does not trigger ml_get error.
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
perldo VIM::DoCommand("%d_")
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
perldo VIM::DoCommand("new")
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
function Test_VIM_package()
|
||||
|
||||
24
src/testdir/test_python2.vim
Normal file
24
src/testdir/test_python2.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Test for python 2 commands.
|
||||
" TODO: move tests from test87.in here.
|
||||
|
||||
if !has('python')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_pydo()
|
||||
" Check deleting lines does not trigger ml_get error.
|
||||
py import vim
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
pydo vim.command("%d_")
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
pydo vim.command("new")
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
24
src/testdir/test_python3.vim
Normal file
24
src/testdir/test_python3.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Test for python 2 commands.
|
||||
" TODO: move tests from test88.in here.
|
||||
|
||||
if !has('python3')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_py3do()
|
||||
" Check deleting lines does not trigger an ml_get error.
|
||||
py3 import vim
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
py3do vim.command("%d_")
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger an ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
py3do vim.command("new")
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
@@ -32,3 +32,20 @@ func Test_ruby_evaluate_dict()
|
||||
redir END
|
||||
call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n"))
|
||||
endfunc
|
||||
|
||||
func Test_rubydo()
|
||||
" Check deleting lines does not trigger ml_get error.
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
rubydo Vim.command("%d_")
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
rubydo Vim.command("new")
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
@@ -94,10 +94,6 @@ function Test_tabpage()
|
||||
call assert_equal(7, tabpagenr())
|
||||
tabmove
|
||||
call assert_equal(10, tabpagenr())
|
||||
tabmove -20
|
||||
call assert_equal(1, tabpagenr())
|
||||
tabmove +20
|
||||
call assert_equal(10, tabpagenr())
|
||||
0tabmove
|
||||
call assert_equal(1, tabpagenr())
|
||||
$tabmove
|
||||
@@ -110,7 +106,16 @@ function Test_tabpage()
|
||||
call assert_equal(4, tabpagenr())
|
||||
7tabmove 5
|
||||
call assert_equal(5, tabpagenr())
|
||||
call assert_fails("99tabmove", 'E16:')
|
||||
call assert_fails("+99tabmove", 'E16:')
|
||||
call assert_fails("-99tabmove", 'E16:')
|
||||
call assert_fails("tabmove foo", 'E474:')
|
||||
call assert_fails("tabmove 99", 'E474:')
|
||||
call assert_fails("tabmove +99", 'E474:')
|
||||
call assert_fails("tabmove -99", 'E474:')
|
||||
call assert_fails("tabmove -3+", 'E474:')
|
||||
call assert_fails("tabmove $3", 'E474:')
|
||||
1tabonly!
|
||||
endfunc
|
||||
|
||||
" Test autocommands
|
||||
@@ -118,7 +123,6 @@ function Test_tabpage_with_autocmd()
|
||||
if !has('autocmd')
|
||||
return
|
||||
endif
|
||||
tabonly!
|
||||
command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args>
|
||||
augroup TestTabpageGroup
|
||||
au!
|
||||
@@ -183,8 +187,10 @@ function Test_tabpage_with_autocmd()
|
||||
|
||||
autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3
|
||||
let s:li = []
|
||||
C tabnext 3
|
||||
call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ===', 'BufEnter', '=== tabclose 3 ==='], s:li)
|
||||
call assert_equal(3, tabpagenr('$'))
|
||||
C tabnext 2
|
||||
call assert_equal(2, tabpagenr('$'))
|
||||
call assert_equal(['=== tabnext 2 ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li)
|
||||
call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')])
|
||||
|
||||
delcommand C
|
||||
@@ -192,8 +198,7 @@ function Test_tabpage_with_autocmd()
|
||||
augroup! TabDestructive
|
||||
autocmd! TestTabpageGroup
|
||||
augroup! TestTabpageGroup
|
||||
tabonly!
|
||||
bw!
|
||||
1tabonly!
|
||||
endfunction
|
||||
|
||||
function Test_tabpage_with_tab_modifier()
|
||||
@@ -224,8 +229,223 @@ function Test_tabpage_with_tab_modifier()
|
||||
call assert_fails('-99tab help', 'E16:')
|
||||
|
||||
delfunction s:check_tab
|
||||
tabonly!
|
||||
bw!
|
||||
1tabonly!
|
||||
endfunction
|
||||
|
||||
function Check_tab_count(pre_nr, cmd, post_nr)
|
||||
exec 'tabnext' a:pre_nr
|
||||
normal! G
|
||||
exec a:cmd
|
||||
call assert_equal(a:post_nr, tabpagenr(), a:cmd)
|
||||
endfunc
|
||||
|
||||
" Test for [count] of tabnext
|
||||
function Test_tabpage_with_tabnext()
|
||||
for n in range(4)
|
||||
tabedit
|
||||
call setline(1, ['', '', '3'])
|
||||
endfor
|
||||
|
||||
call Check_tab_count(1, 'tabnext', 2)
|
||||
call Check_tab_count(1, '3tabnext', 3)
|
||||
call Check_tab_count(1, '.tabnext', 1)
|
||||
call Check_tab_count(1, '.+1tabnext', 2)
|
||||
call Check_tab_count(2, '+tabnext', 3)
|
||||
call Check_tab_count(2, '+2tabnext', 4)
|
||||
call Check_tab_count(4, '-tabnext', 3)
|
||||
call Check_tab_count(4, '-2tabnext', 2)
|
||||
call Check_tab_count(3, '$tabnext', 5)
|
||||
call assert_fails('0tabnext', 'E16:')
|
||||
call assert_fails('99tabnext', 'E16:')
|
||||
call assert_fails('+99tabnext', 'E16:')
|
||||
call assert_fails('-99tabnext', 'E16:')
|
||||
call Check_tab_count(1, 'tabnext 3', 3)
|
||||
call Check_tab_count(2, 'tabnext +', 3)
|
||||
call Check_tab_count(2, 'tabnext +2', 4)
|
||||
call Check_tab_count(4, 'tabnext -', 3)
|
||||
call Check_tab_count(4, 'tabnext -2', 2)
|
||||
call Check_tab_count(3, 'tabnext $', 5)
|
||||
call assert_fails('tabnext 0', 'E474:')
|
||||
call assert_fails('tabnext .', 'E474:')
|
||||
call assert_fails('tabnext -+', 'E474:')
|
||||
call assert_fails('tabnext +2-', 'E474:')
|
||||
call assert_fails('tabnext $3', 'E474:')
|
||||
call assert_fails('tabnext 99', 'E474:')
|
||||
call assert_fails('tabnext +99', 'E474:')
|
||||
call assert_fails('tabnext -99', 'E474:')
|
||||
|
||||
1tabonly!
|
||||
endfunction
|
||||
|
||||
" Test for [count] of tabprevious
|
||||
function Test_tabpage_with_tabprevious()
|
||||
for n in range(5)
|
||||
tabedit
|
||||
call setline(1, ['', '', '3'])
|
||||
endfor
|
||||
|
||||
for cmd in ['tabNext', 'tabprevious']
|
||||
call Check_tab_count(6, cmd, 5)
|
||||
call Check_tab_count(6, '3' . cmd, 3)
|
||||
call Check_tab_count(6, '8' . cmd, 4)
|
||||
call Check_tab_count(6, cmd . ' 3', 3)
|
||||
call Check_tab_count(6, cmd . ' 8', 4)
|
||||
for n in range(2)
|
||||
for c in ['0', '.+3', '+', '+2' , '-', '-2' , '$', '+99', '-99']
|
||||
if n == 0 " pre count
|
||||
let entire_cmd = c . cmd
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = cmd . ' ' . c
|
||||
let err_code = 'E474:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
|
||||
1tabonly!
|
||||
endfunction
|
||||
|
||||
function s:reconstruct_tabpage_for_test(nr)
|
||||
let n = (a:nr > 2) ? a:nr - 2 : 1
|
||||
1tabonly!
|
||||
0tabedit n0
|
||||
for n in range(1, n)
|
||||
exec '$tabedit n' . n
|
||||
if n == 1
|
||||
call setline(1, ['', '', '3'])
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
" Test for [count] of tabclose
|
||||
function Test_tabpage_with_tabclose()
|
||||
|
||||
" pre count
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
call Check_tab_count(3, 'tabclose!', 3)
|
||||
call Check_tab_count(1, '3tabclose', 1)
|
||||
call Check_tab_count(4, '4tabclose', 3)
|
||||
call Check_tab_count(3, '1tabclose', 2)
|
||||
call Check_tab_count(2, 'tabclose', 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
call assert_equal('', bufname(''))
|
||||
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
call Check_tab_count(2, '$tabclose', 2)
|
||||
call Check_tab_count(4, '.tabclose', 4)
|
||||
call Check_tab_count(3, '.+tabclose', 3)
|
||||
call Check_tab_count(3, '.-2tabclose', 2)
|
||||
call Check_tab_count(1, '.+1tabclose!', 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
call assert_equal('', bufname(''))
|
||||
|
||||
" post count
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
call Check_tab_count(3, 'tabclose!', 3)
|
||||
call Check_tab_count(1, 'tabclose 3', 1)
|
||||
call Check_tab_count(4, 'tabclose 4', 3)
|
||||
call Check_tab_count(3, 'tabclose 1', 2)
|
||||
call Check_tab_count(2, 'tabclose', 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
call assert_equal('', bufname(''))
|
||||
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
call Check_tab_count(2, 'tabclose $', 2)
|
||||
call Check_tab_count(4, 'tabclose', 4)
|
||||
call Check_tab_count(3, 'tabclose +', 3)
|
||||
call Check_tab_count(3, 'tabclose -2', 2)
|
||||
call Check_tab_count(1, 'tabclose! +1', 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
call assert_equal('', bufname(''))
|
||||
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
for n in range(2)
|
||||
for c in ['0', '$3', '99', '+99', '-99']
|
||||
if n == 0 " pre count
|
||||
let entire_cmd = c . 'tabclose'
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = 'tabclose ' . c
|
||||
let err_code = 'E474:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
endfor
|
||||
endfor
|
||||
|
||||
call assert_fails('3tabclose', 'E37:')
|
||||
call assert_fails('tabclose 3', 'E37:')
|
||||
call assert_fails('tabclose -+', 'E474:')
|
||||
call assert_fails('tabclose +2-', 'E474:')
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
|
||||
1tabonly!
|
||||
endfunction
|
||||
|
||||
" Test for [count] of tabonly
|
||||
function Test_tabpage_with_tabonly()
|
||||
|
||||
" Test for the normal behavior (pre count only)
|
||||
let tc = [ [4, '.', '!'], [2, '.+', ''], [3, '.-2', '!'], [1, '.+1', '!'] ]
|
||||
for c in tc
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
let entire_cmd = c[1] . 'tabonly' . c[2]
|
||||
call Check_tab_count(c[0], entire_cmd, 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
endfor
|
||||
|
||||
" Test for the normal behavior
|
||||
let tc2 = [ [3, '', ''], [1, '3', ''], [4, '4', '!'], [3, '1', '!'],
|
||||
\ [2, '', '!'],
|
||||
\ [2, '$', '!'], [3, '+', '!'], [3, '-2', '!'], [3, '+1', '!']
|
||||
\ ]
|
||||
for n in range(2)
|
||||
for c in tc2
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
if n == 0 " pre count
|
||||
let entire_cmd = c[1] . 'tabonly' . c[2]
|
||||
else
|
||||
let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
|
||||
endif
|
||||
call Check_tab_count(c[0], entire_cmd, 1)
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Test for the error behavior
|
||||
for n in range(2)
|
||||
for c in ['0', '$3', '99', '+99', '-99']
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
if n == 0 " pre count
|
||||
let entire_cmd = c . 'tabonly'
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = 'tabonly ' . c
|
||||
let err_code = 'E474:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Test for the error behavior (post count only)
|
||||
for c in tc
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
|
||||
let err_code = 'E474:'
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
endfor
|
||||
|
||||
call assert_fails('tabonly -+', 'E474:')
|
||||
call assert_fails('tabonly +2-', 'E474:')
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
|
||||
1tabonly!
|
||||
new
|
||||
only!
|
||||
endfunction
|
||||
|
||||
func Test_tabnext_on_buf_unload1()
|
||||
|
||||
23
src/testdir/test_tcl.vim
Normal file
23
src/testdir/test_tcl.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Tests for the Tcl interface.
|
||||
|
||||
if !has('tcl')
|
||||
finish
|
||||
end
|
||||
|
||||
function Test_tcldo()
|
||||
" Check deleting lines does not trigger ml_get error.
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
tcldo ::vim::command %d_
|
||||
bwipe!
|
||||
|
||||
" Check switching to another buffer does not trigger ml_get error.
|
||||
new
|
||||
let wincount = winnr('$')
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
tcldo ::vim::command new
|
||||
call assert_equal(wincount + 1, winnr('$'))
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
@@ -2,4 +2,12 @@
|
||||
" Always use "sh", don't use the value of "$SHELL".
|
||||
set shell=sh
|
||||
|
||||
" Only when the +eval feature is present.
|
||||
if 1
|
||||
" While some tests overwrite $HOME to prevent them from polluting user files,
|
||||
" 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
|
||||
|
||||
7
src/ui.c
7
src/ui.c
@@ -363,12 +363,19 @@ ui_breakcheck(void)
|
||||
void
|
||||
ui_breakcheck_force(int force)
|
||||
{
|
||||
int save_us = updating_screen;
|
||||
|
||||
/* We do not want gui_resize_shell() to redraw the screen here. */
|
||||
++updating_screen;
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
if (gui.in_use)
|
||||
gui_mch_update();
|
||||
else
|
||||
#endif
|
||||
mch_breakcheck(force);
|
||||
|
||||
updating_screen = save_us;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@@ -3556,7 +3556,7 @@ get_funccal_args_var()
|
||||
{
|
||||
if (current_funccal == NULL)
|
||||
return NULL;
|
||||
return ¤t_funccal->l_avars_var;
|
||||
return &get_funccal()->l_avars_var;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -764,6 +764,64 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
287,
|
||||
/**/
|
||||
286,
|
||||
/**/
|
||||
285,
|
||||
/**/
|
||||
284,
|
||||
/**/
|
||||
283,
|
||||
/**/
|
||||
282,
|
||||
/**/
|
||||
281,
|
||||
/**/
|
||||
280,
|
||||
/**/
|
||||
279,
|
||||
/**/
|
||||
278,
|
||||
/**/
|
||||
277,
|
||||
/**/
|
||||
276,
|
||||
/**/
|
||||
275,
|
||||
/**/
|
||||
274,
|
||||
/**/
|
||||
273,
|
||||
/**/
|
||||
272,
|
||||
/**/
|
||||
271,
|
||||
/**/
|
||||
270,
|
||||
/**/
|
||||
269,
|
||||
/**/
|
||||
268,
|
||||
/**/
|
||||
267,
|
||||
/**/
|
||||
266,
|
||||
/**/
|
||||
265,
|
||||
/**/
|
||||
264,
|
||||
/**/
|
||||
263,
|
||||
/**/
|
||||
262,
|
||||
/**/
|
||||
261,
|
||||
/**/
|
||||
260,
|
||||
/**/
|
||||
259,
|
||||
/**/
|
||||
258,
|
||||
/**/
|
||||
|
||||
@@ -594,6 +594,7 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
|
||||
# endif
|
||||
# define textdomain(domain) (*dyn_libintl_textdomain)(domain)
|
||||
# define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring)
|
||||
# define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring)
|
||||
# else
|
||||
# include <libintl.h>
|
||||
# define _(x) gettext((char *)(x))
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/*
|
||||
* winclip.c
|
||||
*
|
||||
* Routines common to both Win16 and Win32 for clipboard handling.
|
||||
* Routines for Win32 clipboard handling.
|
||||
* Also used by Cygwin, using os_unix.c.
|
||||
*/
|
||||
|
||||
@@ -214,9 +214,8 @@ typedef struct
|
||||
/*
|
||||
* Make vim the owner of the current selection. Return OK upon success.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd)
|
||||
clip_mch_own_selection(VimClipboard *cbd UNUSED)
|
||||
{
|
||||
/*
|
||||
* Never actually own the clipboard. If another application sets the
|
||||
@@ -228,9 +227,8 @@ clip_mch_own_selection(VimClipboard *cbd)
|
||||
/*
|
||||
* Make vim NOT the owner of the current selection.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd)
|
||||
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
||||
{
|
||||
/* Nothing needs to be done here */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user