Skip to content

Commit e46fc37

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 80c7724 + d85f271 commit e46fc37

27 files changed

Lines changed: 686 additions & 253 deletions

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
language: c
2+
# trusty still has a few problems, use precise until they are solved.
3+
dist: precise
24

35
os:
46
- osx

runtime/doc/eval.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.0. Last change: 2017 Jul 22
1+
*eval.txt* For Vim version 8.0. Last change: 2017 Jul 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3255,11 +3255,16 @@ cosh({expr}) *cosh()*
32553255

32563256
count({comp}, {expr} [, {ic} [, {start}]]) *count()*
32573257
Return the number of times an item with value {expr} appears
3258-
in |List| or |Dictionary| {comp}.
3258+
in |String|, |List| or |Dictionary| {comp}.
3259+
32593260
If {start} is given then start with the item with this index.
32603261
{start} can only be used with a |List|.
3262+
32613263
When {ic} is given and it's |TRUE| then case is ignored.
32623264

3265+
When {comp} is a string then the number of not overlapping
3266+
occurences of {expr} is returned.
3267+
32633268

32643269
*cscope_connection()*
32653270
cscope_connection([{num} , {dbpath} [, {prepend}]])

runtime/doc/terminal.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*terminal.txt* For Vim version 8.0. Last change: 2017 Jul 24
1+
*terminal.txt* For Vim version 8.0. Last change: 2017 Jul 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -33,22 +33,27 @@ Or to run a debugger: >
3333
The job runs asynchronously from Vim, the window will be updated to show
3434
output from the job, also while editing in any other window.
3535

36+
Typing ~
37+
3638
When the keyboard focus is in the terminal window, typed keys will be send to
37-
the job. This uses a pty when possible.
39+
the job. This uses a pty when possible. You can click outside of the
40+
terminal window to move keyboard focus elsewhere.
41+
42+
Navigate between windows with CTRL-W commands. E.g. CTRL-W CTRL-W moves focus
43+
to the next window. Use "CTRL-W :" to edit an Ex command. Use "CTRL-W ." to
44+
send a CTRL-W to the job in the terminal.
3845

39-
Navigate between windows with CTRL-W commands (and mouse).
40-
E.g. CTRL-W CTRL-W moves focus to the next window.
41-
Use "CTRL-W :" to edit an Ex command.
46+
See option 'termkey' for specifying another key that precedes a Vim command.
47+
Typing 'termkey' twice sends 'termkey' to the job.
4248

43-
See option 'termkey' for specifying the key that precedes a Vim command.
44-
Default is CTRL-W.
49+
Size ~
4550

4651
See option 'termsize' for controlling the size of the terminal window.
4752
(TODO: scrolling when the terminal is larger than the window)
4853

4954
Syntax ~
5055

51-
:ter[minal][!] [command] *:ter* *:terminal*
56+
:ter[minal] [command] *:ter* *:terminal*
5257
Open a new terminal window.
5358

5459
If [command] is provided run it as a job and connect

src/Make_mvc.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ $(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL)
13411341

13421342
if_perl.c : if_perl.xs typemap
13431343
$(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
1344-
-typemap typemap if_perl.xs > if_perl.c
1344+
-typemap typemap if_perl.xs -output if_perl.c
13451345

13461346
$(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
13471347
$(CC) $(CFLAGS_OUTDIR) $(PERL_INC) if_perl.c
@@ -1470,7 +1470,7 @@ $(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
14701470
$(OUTDIR)/glbl_ime.obj: $(OUTDIR) glbl_ime.cpp dimm.h $(INCL)
14711471

14721472

1473-
CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf
1473+
CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf -D_CRT_SECURE_NO_WARNINGS
14741474
$(OUTDIR)/term_encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS)
14751475
$(CCCTERM) -Fo$@ libvterm/src/encoding.c
14761476

src/buffer.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ open_buffer(
249249
netbeansFireChanges = oldFire;
250250
#endif
251251
/* Help buffer is filtered. */
252-
if (curbuf->b_help)
252+
if (bt_help(curbuf))
253253
fix_help_buffer();
254254
}
255255
else if (read_stdin)
@@ -862,7 +862,7 @@ free_buffer(buf_T *buf)
862862
channel_buffer_free(buf);
863863
#endif
864864
#ifdef FEAT_TERMINAL
865-
free_terminal(buf->b_term);
865+
free_terminal(buf);
866866
#endif
867867

868868
buf_hashtab_remove(buf);
@@ -5678,6 +5678,15 @@ bt_terminal(buf_T *buf)
56785678
return buf != NULL && buf->b_p_bt[0] == 't';
56795679
}
56805680

5681+
/*
5682+
* Return TRUE if "buf" is a help buffer.
5683+
*/
5684+
int
5685+
bt_help(buf_T *buf)
5686+
{
5687+
return buf != NULL && buf->b_help;
5688+
}
5689+
56815690
/*
56825691
* Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer.
56835692
* This means the buffer name is not a file name.

src/channel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,10 @@ channel_close(channel_T *channel, int invoke_close_cb)
29422942
}
29432943

29442944
channel->ch_nb_close_cb = NULL;
2945+
2946+
#ifdef FEAT_TERMINAL
2947+
term_channel_closed(channel);
2948+
#endif
29452949
}
29462950

29472951
/*
@@ -4721,10 +4725,6 @@ job_cleanup(job_T *job)
47214725
* not use "job" after this! */
47224726
job_free(job);
47234727
}
4724-
4725-
#ifdef FEAT_TERMINAL
4726-
term_job_ended(job);
4727-
#endif
47284728
}
47294729

47304730
/*

src/eval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5329,6 +5329,10 @@ garbage_collect(int testing)
53295329
abort = abort || set_ref_in_quickfix(copyID);
53305330
#endif
53315331

5332+
#ifdef FEAT_TERMINAL
5333+
abort = abort || set_ref_in_term(copyID);
5334+
#endif
5335+
53325336
if (!abort)
53335337
{
53345338
/*

src/evalfunc.c

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,8 +2314,45 @@ f_count(typval_T *argvars, typval_T *rettv)
23142314
{
23152315
long n = 0;
23162316
int ic = FALSE;
2317+
int error = FALSE;
23172318

2318-
if (argvars[0].v_type == VAR_LIST)
2319+
if (argvars[2].v_type != VAR_UNKNOWN)
2320+
ic = (int)get_tv_number_chk(&argvars[2], &error);
2321+
2322+
if (argvars[0].v_type == VAR_STRING)
2323+
{
2324+
char_u *expr = get_tv_string_chk(&argvars[1]);
2325+
char_u *p = argvars[0].vval.v_string;
2326+
char_u *next;
2327+
2328+
if (!error && expr != NULL && p != NULL)
2329+
{
2330+
if (ic)
2331+
{
2332+
size_t len = STRLEN(expr);
2333+
2334+
while (*p != NUL)
2335+
{
2336+
if (MB_STRNICMP(p, expr, len) == 0)
2337+
{
2338+
++n;
2339+
p += len;
2340+
}
2341+
else
2342+
MB_PTR_ADV(p);
2343+
}
2344+
}
2345+
else
2346+
while ((next = (char_u *)strstr((char *)p, (char *)expr))
2347+
!= NULL)
2348+
{
2349+
++n;
2350+
p = next + STRLEN(expr);
2351+
}
2352+
}
2353+
2354+
}
2355+
else if (argvars[0].v_type == VAR_LIST)
23192356
{
23202357
listitem_T *li;
23212358
list_T *l;
@@ -2326,9 +2363,6 @@ f_count(typval_T *argvars, typval_T *rettv)
23262363
li = l->lv_first;
23272364
if (argvars[2].v_type != VAR_UNKNOWN)
23282365
{
2329-
int error = FALSE;
2330-
2331-
ic = (int)get_tv_number_chk(&argvars[2], &error);
23322366
if (argvars[3].v_type != VAR_UNKNOWN)
23332367
{
23342368
idx = (long)get_tv_number_chk(&argvars[3], &error);
@@ -2356,11 +2390,8 @@ f_count(typval_T *argvars, typval_T *rettv)
23562390

23572391
if ((d = argvars[0].vval.v_dict) != NULL)
23582392
{
2359-
int error = FALSE;
2360-
23612393
if (argvars[2].v_type != VAR_UNKNOWN)
23622394
{
2363-
ic = (int)get_tv_number_chk(&argvars[2], &error);
23642395
if (argvars[3].v_type != VAR_UNKNOWN)
23652396
EMSG(_(e_invarg));
23662397
}

src/ex_cmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6314,7 +6314,7 @@ ex_help(exarg_T *eap)
63146314
* Re-use an existing help window or open a new one.
63156315
* Always open a new one for ":tab help".
63166316
*/
6317-
if (!curwin->w_buffer->b_help
6317+
if (!bt_help(curwin->w_buffer)
63186318
#ifdef FEAT_WINDOWS
63196319
|| cmdmod.tab != 0
63206320
#endif
@@ -6325,7 +6325,7 @@ ex_help(exarg_T *eap)
63256325
wp = NULL;
63266326
else
63276327
FOR_ALL_WINDOWS(wp)
6328-
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
6328+
if (bt_help(wp->w_buffer))
63296329
break;
63306330
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
63316331
win_enter(wp, TRUE);
@@ -6425,7 +6425,7 @@ ex_helpclose(exarg_T *eap UNUSED)
64256425

64266426
FOR_ALL_WINDOWS(win)
64276427
{
6428-
if (win->w_buffer->b_help)
6428+
if (bt_help(win->w_buffer))
64296429
{
64306430
win_close(win, FALSE);
64316431
return;

src/ex_cmds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ EX(CMD_tearoff, "tearoff", ex_tearoff,
14901490
NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN,
14911491
ADDR_LINES),
14921492
EX(CMD_terminal, "terminal", ex_terminal,
1493-
RANGE|NOTADR|EXTRA|TRLBAR|CMDWIN,
1493+
RANGE|NOTADR|FILES|TRLBAR|CMDWIN,
14941494
ADDR_OTHER),
14951495
EX(CMD_tfirst, "tfirst", ex_tag,
14961496
RANGE|NOTADR|BANG|TRLBAR|ZEROR,

0 commit comments

Comments
 (0)