Skip to content

Commit 62de4e4

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents a3f7952 + 2949595 commit 62de4e4

76 files changed

Lines changed: 1117 additions & 879 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runtime/doc/autocmd.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*autocmd.txt* For Vim version 8.0. Last change: 2018 Feb 09
1+
*autocmd.txt* For Vim version 8.0. Last change: 2018 Feb 10
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -332,6 +332,9 @@ Name triggered by ~
332332

333333
|TextChanged| after a change was made to the text in Normal mode
334334
|TextChangedI| after a change was made to the text in Insert mode
335+
when popup menu is not visible
336+
|TextChangedP| after a change was made to the text in Insert mode
337+
when popup menu visible
335338
|TextYankPost| after text is yanked or deleted
336339

337340
|ColorScheme| after loading a color scheme
@@ -976,6 +979,11 @@ TextChangedI After a change was made to the text in the
976979
current buffer in Insert mode.
977980
Not triggered when the popup menu is visible.
978981
Otherwise the same as TextChanged.
982+
*TextChangedP*
983+
TextChangedP After a change was made to the text in the
984+
current buffer in Insert mode, only when the
985+
popup menu is visible. Otherwise the same as
986+
TextChanged.
979987
*TextYankPost*
980988
TextYankPost After text has been yanked or deleted in the
981989
current buffer. The following values of

runtime/doc/eval.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.0. Last change: 2018 Feb 09
1+
*eval.txt* For Vim version 8.0. Last change: 2018 Feb 10
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2167,6 +2167,8 @@ getfperm({fname}) String file permissions of file {fname}
21672167
getfsize({fname}) Number size in bytes of file {fname}
21682168
getftime({fname}) Number last modification time of file
21692169
getftype({fname}) String description of type of file {fname}
2170+
getjumplist([{winnr} [, {tabnr}]])
2171+
List list of jump list items
21702172
getline({lnum}) String line {lnum} of current buffer
21712173
getline({lnum}, {end}) List lines {lnum} to {end} of current buffer
21722174
getloclist({nr} [, {what}]) List list of location list items
@@ -4560,6 +4562,26 @@ getftype({fname}) *getftype()*
45604562
"file" are returned. On MS-Windows a symbolic link to a
45614563
directory returns "dir" instead of "link".
45624564

4565+
*getjumplist()*
4566+
getjumplist([{winnr} [, {tabnr}]])
4567+
Returns the |jumplist| for the specified window.
4568+
4569+
Without arguments use the current window.
4570+
With {winnr} only use this window in the current tab page.
4571+
{winnr} can also be a |window-ID|.
4572+
With {winnr} and {tabnr} use the window in the specified tab
4573+
page.
4574+
4575+
The returned list contains two entries: a list with the jump
4576+
locations and the last used jump position number in the list.
4577+
Each entry in the jump location list is a dictionary with
4578+
the following entries:
4579+
bufnr buffer number
4580+
col column number
4581+
coladd column offset for 'virtualedit'
4582+
filename filename if available
4583+
lnum line number
4584+
45634585
*getline()*
45644586
getline({lnum} [, {end}])
45654587
Without {end} the result is a String, which is line {lnum}

runtime/doc/repeat.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,19 @@ DEFINING BREAKPOINTS
806806
< Note that this only works for commands that are executed when
807807
sourcing the file, not for a function defined in that file.
808808

809+
:breaka[dd] expr {expression}
810+
Sets a breakpoint, that will break whenever the {expression}
811+
evaluates to a different value. Example: >
812+
:breakadd expr g:lnum
813+
814+
< Will break, whenever the global variable lnum changes.
815+
Note if you watch a |script-variable| this will break
816+
when switching scripts, since the script variable is only
817+
valid in the script where it has been defined and if that
818+
script is called from several other scripts, this will stop
819+
whenever that particular variable will become visible or
820+
unaccessible again.
821+
809822
The [lnum] is the line number of the breakpoint. Vim will stop at or after
810823
this line. When omitted line 1 is used.
811824

runtime/doc/usr_41.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ Buffers, windows and the argument list:
807807
getbufinfo() get a list with buffer information
808808
gettabinfo() get a list with tab page information
809809
getwininfo() get a list with window information
810+
getjumplist() get a list of jump list entries
810811

811812
Command line: *command-line-functions*
812813
getcmdline() get the current command line

runtime/doc/windows.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@ can also get to them with the buffer list commands, like ":bnext".
711711
When using the |:tab| modifier each argument is opened in a
712712
tab page. The last window is used if it's empty.
713713
Also see |++opt| and |+cmd|.
714-
{only available when compiled with a GUI}
715714

716715
==============================================================================
717716
8. Do a command in all buffers or windows *list-repeat*

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,7 @@ test_arglist \
22152215
test_job_fails \
22162216
test_join \
22172217
test_json \
2218+
test_jumplist \
22182219
test_jumps \
22192220
test_lambda \
22202221
test_langmap \

src/buffer.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,7 @@ free_buffer_stuff(
948948
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
949949
#endif
950950
#ifdef FEAT_MBYTE
951-
vim_free(buf->b_start_fenc);
952-
buf->b_start_fenc = NULL;
951+
VIM_CLEAR(buf->b_start_fenc);
953952
#endif
954953
}
955954

@@ -2041,10 +2040,8 @@ buflist_new(
20412040
if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL))
20422041
|| buf->b_wininfo == NULL)
20432042
{
2044-
vim_free(buf->b_ffname);
2045-
buf->b_ffname = NULL;
2046-
vim_free(buf->b_sfname);
2047-
buf->b_sfname = NULL;
2043+
VIM_CLEAR(buf->b_ffname);
2044+
VIM_CLEAR(buf->b_sfname);
20482045
if (buf != curbuf)
20492046
free_buffer(buf);
20502047
return NULL;
@@ -3140,10 +3137,8 @@ setfname(
31403137
if (ffname == NULL || *ffname == NUL)
31413138
{
31423139
/* Removing the name. */
3143-
vim_free(buf->b_ffname);
3144-
vim_free(buf->b_sfname);
3145-
buf->b_ffname = NULL;
3146-
buf->b_sfname = NULL;
3140+
VIM_CLEAR(buf->b_ffname);
3141+
VIM_CLEAR(buf->b_sfname);
31473142
#ifdef UNIX
31483143
st.st_dev = (dev_T)-1;
31493144
#endif
@@ -4271,8 +4266,7 @@ build_stl_str_hl(
42714266
if (*skipdigits(str) == NUL)
42724267
{
42734268
num = atoi((char *)str);
4274-
vim_free(str);
4275-
str = NULL;
4269+
VIM_CLEAR(str);
42764270
itemisflag = FALSE;
42774271
}
42784272
}

src/channel.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ channel_still_useful(channel_T *channel)
320320
/* If there is no callback then nobody can get readahead. If the fd is
321321
* closed and there is no readahead then the callback won't be called. */
322322
has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD
323-
|| channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
324-
|| channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
323+
|| channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
324+
|| channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
325325
has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD
326326
|| channel->ch_part[PART_OUT].ch_head.rq_next != NULL
327327
|| channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL;
@@ -2997,8 +2997,7 @@ channel_clear_one(channel_T *channel, ch_part_T part)
29972997
channel_clear(channel_T *channel)
29982998
{
29992999
ch_log(channel, "Clearing channel");
3000-
vim_free(channel->ch_hostname);
3001-
channel->ch_hostname = NULL;
3000+
VIM_CLEAR(channel->ch_hostname);
30023001
channel_clear_one(channel, PART_SOCK);
30033002
channel_clear_one(channel, PART_OUT);
30043003
channel_clear_one(channel, PART_ERR);

src/crypt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = {
118118
NULL, NULL,
119119
crypt_blowfish_encode, crypt_blowfish_decode,
120120
},
121+
122+
/* NOTE: when adding a new method, use some random bytes for the magic key,
123+
* to avoid that a text file is recognized as encrypted. */
121124
};
122125

123126
#define CRYPT_MAGIC_LEN 12 /* cannot change */
@@ -349,10 +352,7 @@ crypt_create_for_writing(
349352

350353
state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len);
351354
if (state == NULL)
352-
{
353-
vim_free(*header);
354-
*header = NULL;
355-
}
355+
VIM_CLEAR(*header);
356356
return state;
357357
}
358358

src/edit.c

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,17 +1691,28 @@ ins_redraw(
16911691
#ifdef FEAT_AUTOCMD
16921692
/* Trigger TextChangedI if b_changedtick differs. */
16931693
if (ready && has_textchangedI()
1694-
&& last_changedtick != CHANGEDTICK(curbuf)
1694+
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf)
16951695
# ifdef FEAT_INS_EXPAND
16961696
&& !pum_visible()
16971697
# endif
16981698
)
16991699
{
1700-
if (last_changedtick_buf == curbuf)
1701-
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
1702-
last_changedtick_buf = curbuf;
1703-
last_changedtick = CHANGEDTICK(curbuf);
1700+
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
1701+
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
17041702
}
1703+
1704+
# ifdef FEAT_INS_EXPAND
1705+
/* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes
1706+
* TextChangedI will need to trigger for backwards compatibility, thus use
1707+
* different b_last_changedtick* variables. */
1708+
if (ready && has_textchangedP()
1709+
&& curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf)
1710+
&& pum_visible())
1711+
{
1712+
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf);
1713+
curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf);
1714+
}
1715+
# endif
17051716
#endif
17061717

17071718
if (must_redraw)
@@ -2937,7 +2948,7 @@ ins_compl_del_pum(void)
29372948
if (compl_match_array != NULL)
29382949
{
29392950
pum_undisplay();
2940-
vim_clear((void **)&compl_match_array);
2951+
VIM_CLEAR(compl_match_array);
29412952
}
29422953
}
29432954

@@ -3439,8 +3450,8 @@ ins_compl_free(void)
34393450
compl_T *match;
34403451
int i;
34413452

3442-
vim_clear((void **)&compl_pattern);
3443-
vim_clear((void **)&compl_leader);
3453+
VIM_CLEAR(compl_pattern);
3454+
VIM_CLEAR(compl_leader);
34443455

34453456
if (compl_first_match == NULL)
34463457
return;
@@ -3472,10 +3483,10 @@ ins_compl_clear(void)
34723483
compl_cont_status = 0;
34733484
compl_started = FALSE;
34743485
compl_matches = 0;
3475-
vim_clear((void **)&compl_pattern);
3476-
vim_clear((void **)&compl_leader);
3486+
VIM_CLEAR(compl_pattern);
3487+
VIM_CLEAR(compl_leader);
34773488
edit_submode_extra = NULL;
3478-
vim_clear((void **)&compl_orig_text);
3489+
VIM_CLEAR(compl_orig_text);
34793490
compl_enter_selects = FALSE;
34803491
/* clear v:completed_item */
34813492
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
@@ -5587,8 +5598,8 @@ ins_complete(int c, int enable_pum)
55875598
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
55885599
-1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK)
55895600
{
5590-
vim_clear((void **)&compl_pattern);
5591-
vim_clear((void **)&compl_orig_text);
5601+
VIM_CLEAR(compl_pattern);
5602+
VIM_CLEAR(compl_orig_text);
55925603
return FAIL;
55935604
}
55945605

@@ -7217,9 +7228,9 @@ set_last_insert(int c)
72177228
void
72187229
free_last_insert(void)
72197230
{
7220-
vim_clear((void **)&last_insert);
7231+
VIM_CLEAR(last_insert);
72217232
# ifdef FEAT_INS_EXPAND
7222-
vim_clear((void **)&compl_orig_text);
7233+
VIM_CLEAR(compl_orig_text);
72237234
# endif
72247235
}
72257236
#endif
@@ -7847,7 +7858,7 @@ mb_replace_pop_ins(int cc)
78477858
static void
78487859
replace_flush(void)
78497860
{
7850-
vim_clear((void **)&replace_stack);
7861+
VIM_CLEAR(replace_stack);
78517862
replace_stack_len = 0;
78527863
replace_stack_nr = 0;
78537864
}

0 commit comments

Comments
 (0)