Skip to content

Commit

Permalink
Merge remote-tracking branch 'root_branch/master' into proposal_mode_…
Browse files Browse the repository at this point in the history
…function_improvement
  • Loading branch information
h-east committed Mar 24, 2018
2 parents 635d3b0 + 8c64a36 commit 23f8109
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/buffer.c
Expand Up @@ -291,6 +291,13 @@ open_buffer(
unchanged(curbuf, FALSE);
save_file_ff(curbuf); /* keep this fileformat */

/* Set last_changedtick to avoid triggering a TextChanged autocommand right
* after it was added. */
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
#ifdef FEAT_INS_EXPAND
curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf);
#endif

/* require "!" to overwrite the file, because it wasn't read completely */
#ifdef FEAT_EVAL
if (aborting())
Expand Down
9 changes: 9 additions & 0 deletions src/terminal.c
Expand Up @@ -3396,6 +3396,15 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)

for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i)
{
int c = cell.chars[i];
int pc = prev_cell.chars[i];

/* For the first character NUL is the same as space. */
if (i == 0)
{
c = (c == NUL) ? ' ' : c;
pc = (pc == NUL) ? ' ' : pc;
}
if (cell.chars[i] != prev_cell.chars[i])
same_chars = FALSE;
if (cell.chars[i] == NUL || prev_cell.chars[i] == NUL)
Expand Down
4 changes: 4 additions & 0 deletions src/testdir/screendump.vim
Expand Up @@ -26,6 +26,10 @@ source shared.vim
"
" Options is a dictionary (not used yet).
func RunVimInTerminal(arguments, options)
" If Vim doesn't exit a swap file remains, causing other tests to fail.
" Remove it here.
call delete(".swp")

" Make a horizontal and vertical split, so that we can get exactly the right
" size terminal window. Works only when we currently have one window.
call assert_equal(1, winnr('$'))
Expand Down
21 changes: 21 additions & 0 deletions src/testdir/test_autocmd.vim
@@ -1,5 +1,7 @@
" Tests for autocommands

source shared.vim

func! s:cleanup_buffers() abort
for bnr in range(1, bufnr('$'))
if bufloaded(bnr) && bufnr('%') != bnr
Expand Down Expand Up @@ -1304,3 +1306,22 @@ func Test_ChangedP()

bw!
endfunc

func Test_Changed_FirstTime()
if !has('terminal') || has('gui_running')
return
endif
" Prepare file for TextChanged event.
call writefile([''], 'Xchanged.txt')
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
call assert_equal('running', term_getstatus(buf))
" It's only adding autocmd, so that no event occurs.
call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>")
call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>")
call WaitFor({-> term_getstatus(buf) == 'finished'})
call assert_equal([''], readfile('Xchanged.txt'))

" clean up
call delete('Xchanged.txt')
bwipe!
endfunc
6 changes: 6 additions & 0 deletions src/version.c
Expand Up @@ -766,6 +766,12 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1633,
/**/
1632,
/**/
1631,
/**/
1630,
/**/
Expand Down

0 comments on commit 23f8109

Please sign in to comment.