Skip to content

Commit 2bf2752

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents f1c9c25 + 012eb66 commit 2bf2752

7 files changed

Lines changed: 62 additions & 30 deletions

File tree

src/json.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,9 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
621621
if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY
622622
&& (options & JSON_JS)
623623
&& reader->js_buf[reader->js_used] != '"'
624-
&& reader->js_buf[reader->js_used] != '\'')
624+
&& reader->js_buf[reader->js_used] != '\''
625+
&& reader->js_buf[reader->js_used] != '['
626+
&& reader->js_buf[reader->js_used] != '{')
625627
{
626628
char_u *key;
627629

@@ -642,6 +644,11 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
642644
switch (*p)
643645
{
644646
case '[': /* start of array */
647+
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
648+
{
649+
retval = FAIL;
650+
break;
651+
}
645652
if (ga_grow(&stack, 1) == FAIL)
646653
{
647654
retval = FAIL;
@@ -668,6 +675,11 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
668675
continue;
669676

670677
case '{': /* start of object */
678+
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
679+
{
680+
retval = FAIL;
681+
break;
682+
}
671683
if (ga_grow(&stack, 1) == FAIL)
672684
{
673685
retval = FAIL;

src/terminal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,8 +2743,11 @@ term_update_window(win_T *wp)
27432743
else
27442744
pos.col = 0;
27452745

2746-
screen_line(wp->w_winrow + pos.row + winbar_height(wp),
2747-
wp->w_wincol, pos.col, wp->w_width, FALSE);
2746+
screen_line(wp->w_winrow + pos.row
2747+
#ifdef FEAT_MENU
2748+
+ winbar_height(wp)
2749+
#endif
2750+
, wp->w_wincol, pos.col, wp->w_width, FALSE);
27482751
}
27492752
term->tl_dirty_row_start = MAX_ROW;
27502753
term->tl_dirty_row_end = 0;

src/testdir/shared.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ func CanRunGui()
260260
return has('gui') && ($DISPLAY != "" || has('gui_running') || has('gui_macvim'))
261261
endfunc
262262

263+
func WorkingClipboard()
264+
if !has('clipboard')
265+
return 0
266+
endif
267+
if has('x11')
268+
return $DISPLAY != ""
269+
endif
270+
return 1
271+
endfunc
272+
263273
" Get line "lnum" as displayed on the screen.
264274
" Trailing white space is trimmed.
265275
func! Screenline(lnum)

src/testdir/test_json.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ func Test_json_decode()
179179
call assert_fails('call json_decode("[1 2]")', "E474:")
180180

181181
call assert_fails('call json_decode("[1,,2]")', "E474:")
182+
183+
call assert_fails('call json_decode("{{}:42}")', "E474:")
184+
call assert_fails('call json_decode("{[]:42}")', "E474:")
182185
endfunc
183186

184187
let s:jsl5 = '[7,,,]'

src/testdir/test_paste.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if has('gui_running')
66
endif
77
set term=xterm
88

9+
source shared.vim
10+
911
func Test_paste_normal_mode()
1012
new
1113
" In first column text is inserted
@@ -67,7 +69,7 @@ func Test_paste_insert_mode()
6769
endfunc
6870

6971
func Test_paste_clipboard()
70-
if !has('clipboard')
72+
if !WorkingClipboard()
7173
return
7274
endif
7375
let @+ = "nasty\<Esc>:!ls\<CR>command"

src/testdir/test_terminal.vim

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -432,39 +432,38 @@ func Test_terminal_servername()
432432
if !has('clientserver')
433433
return
434434
endif
435-
let g:buf = Run_shell_in_terminal({})
435+
let buf = Run_shell_in_terminal({})
436436
" Wait for the shell to display a prompt
437-
call WaitFor('term_getline(g:buf, 1) != ""')
437+
call WaitFor({-> term_getline(buf, 1) != ""})
438438
if has('win32')
439-
call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r")
439+
call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r")
440440
else
441-
call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r")
441+
call term_sendkeys(buf, "echo $VIM_SERVERNAME\r")
442442
endif
443-
call term_wait(g:buf)
444-
call Stop_shell_in_terminal(g:buf)
443+
call term_wait(buf)
444+
call Stop_shell_in_terminal(buf)
445445
call WaitFor('getline(2) == v:servername')
446446
call assert_equal(v:servername, getline(2))
447447

448-
exe g:buf . 'bwipe'
449-
unlet g:buf
448+
exe buf . 'bwipe'
449+
unlet buf
450450
endfunc
451451

452452
func Test_terminal_env()
453-
let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
453+
let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
454454
" Wait for the shell to display a prompt
455-
call WaitFor('term_getline(g:buf, 1) != ""')
455+
call WaitFor({-> term_getline(buf, 1) != ""})
456456
if has('win32')
457-
call term_sendkeys(g:buf, "echo %TESTENV%\r")
457+
call term_sendkeys(buf, "echo %TESTENV%\r")
458458
else
459-
call term_sendkeys(g:buf, "echo $TESTENV\r")
459+
call term_sendkeys(buf, "echo $TESTENV\r")
460460
endif
461-
call term_wait(g:buf)
462-
call Stop_shell_in_terminal(g:buf)
461+
call term_wait(buf)
462+
call Stop_shell_in_terminal(buf)
463463
call WaitFor('getline(2) == "correct"')
464464
call assert_equal('correct', getline(2))
465465

466-
exe g:buf . 'bwipe'
467-
unlet g:buf
466+
exe buf . 'bwipe'
468467
endfunc
469468

470469
" must be last, we can't go back from GUI to terminal
@@ -596,8 +595,7 @@ func Test_terminal_no_cmd()
596595
else
597596
call system('echo "look here" > ' . pty)
598597
endif
599-
let g:buf = buf
600-
call WaitFor('term_getline(g:buf, 1) =~ "look here"')
598+
call WaitFor({-> term_getline(buf, 1) =~ "look here"})
601599

602600
call assert_match('look here', term_getline(buf, 1))
603601
bwipe!
@@ -677,8 +675,7 @@ func TerminalTmap(remap)
677675
call assert_equal('456', maparg('123', 't'))
678676
call assert_equal('abxde', maparg('456', 't'))
679677
call feedkeys("123", 'tx')
680-
let g:buf = buf
681-
call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abxde\\|456'")
678+
call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'})
682679
let lnum = term_getcursor(buf)[0]
683680
if a:remap
684681
call assert_match('abxde', term_getline(buf, lnum))
@@ -826,12 +823,9 @@ func Test_terminal_response_to_control_sequence()
826823
endif
827824

828825
let buf = Run_shell_in_terminal({})
829-
call term_wait(buf)
826+
call WaitFor({-> term_getline(buf, 1) != ""})
830827

831-
new
832-
call setline(1, "\x1b[6n")
833-
write! Xescape
834-
bwipe
828+
call writefile(["\x1b[6n"], 'Xescape')
835829
call term_sendkeys(buf, "cat Xescape\<cr>")
836830

837831
" wait for the response of control sequence from libvterm (and send it to tty)
@@ -919,7 +913,7 @@ func Test_terminal_qall_prompt()
919913
quit
920914
endfunc
921915

922-
func Test_terminalopen_autocmd()
916+
func Test_terminal_open_autocmd()
923917
augroup repro
924918
au!
925919
au TerminalOpen * let s:called += 1

src/version.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,14 @@ static char *(features[]) =
781781

782782
static int included_patches[] =
783783
{ /* Add new patch number below this line */
784+
/**/
785+
1605,
786+
/**/
787+
1604,
788+
/**/
789+
1603,
790+
/**/
791+
1602,
784792
/**/
785793
1601,
786794
/**/

0 commit comments

Comments
 (0)