diff --git a/src/json.c b/src/json.c index 6f914ea03d..e1f40bf652 100644 --- a/src/json.c +++ b/src/json.c @@ -621,7 +621,9 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY && (options & JSON_JS) && reader->js_buf[reader->js_used] != '"' - && reader->js_buf[reader->js_used] != '\'') + && reader->js_buf[reader->js_used] != '\'' + && reader->js_buf[reader->js_used] != '[' + && reader->js_buf[reader->js_used] != '{') { char_u *key; @@ -642,6 +644,11 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) switch (*p) { case '[': /* start of array */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } if (ga_grow(&stack, 1) == FAIL) { retval = FAIL; @@ -668,6 +675,11 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) continue; case '{': /* start of object */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } if (ga_grow(&stack, 1) == FAIL) { retval = FAIL; diff --git a/src/terminal.c b/src/terminal.c index a11175fe98..7c0d488526 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -2743,8 +2743,11 @@ term_update_window(win_T *wp) else pos.col = 0; - screen_line(wp->w_winrow + pos.row + winbar_height(wp), - wp->w_wincol, pos.col, wp->w_width, FALSE); + screen_line(wp->w_winrow + pos.row +#ifdef FEAT_MENU + + winbar_height(wp) +#endif + , wp->w_wincol, pos.col, wp->w_width, FALSE); } term->tl_dirty_row_start = MAX_ROW; term->tl_dirty_row_end = 0; diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index 4d829fc244..b17d30298c 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -260,6 +260,16 @@ func CanRunGui() return has('gui') && ($DISPLAY != "" || has('gui_running') || has('gui_macvim')) endfunc +func WorkingClipboard() + if !has('clipboard') + return 0 + endif + if has('x11') + return $DISPLAY != "" + endif + return 1 +endfunc + " Get line "lnum" as displayed on the screen. " Trailing white space is trimmed. func! Screenline(lnum) diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim index acd2ea85b5..396651e6be 100644 --- a/src/testdir/test_json.vim +++ b/src/testdir/test_json.vim @@ -179,6 +179,9 @@ func Test_json_decode() call assert_fails('call json_decode("[1 2]")', "E474:") call assert_fails('call json_decode("[1,,2]")', "E474:") + + call assert_fails('call json_decode("{{}:42}")', "E474:") + call assert_fails('call json_decode("{[]:42}")', "E474:") endfunc let s:jsl5 = '[7,,,]' diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim index 6450989ec0..65f300cef0 100644 --- a/src/testdir/test_paste.vim +++ b/src/testdir/test_paste.vim @@ -6,6 +6,8 @@ if has('gui_running') endif set term=xterm +source shared.vim + func Test_paste_normal_mode() new " In first column text is inserted @@ -67,7 +69,7 @@ func Test_paste_insert_mode() endfunc func Test_paste_clipboard() - if !has('clipboard') + if !WorkingClipboard() return endif let @+ = "nasty\:!ls\command" diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 019978b534..6efa0433ab 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -432,39 +432,38 @@ func Test_terminal_servername() if !has('clientserver') return endif - let g:buf = Run_shell_in_terminal({}) + let buf = Run_shell_in_terminal({}) " Wait for the shell to display a prompt - call WaitFor('term_getline(g:buf, 1) != ""') + call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') - call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r") + call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r") else - call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r") + call term_sendkeys(buf, "echo $VIM_SERVERNAME\r") endif - call term_wait(g:buf) - call Stop_shell_in_terminal(g:buf) + call term_wait(buf) + call Stop_shell_in_terminal(buf) call WaitFor('getline(2) == v:servername') call assert_equal(v:servername, getline(2)) - exe g:buf . 'bwipe' - unlet g:buf + exe buf . 'bwipe' + unlet buf endfunc func Test_terminal_env() - let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) + let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) " Wait for the shell to display a prompt - call WaitFor('term_getline(g:buf, 1) != ""') + call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') - call term_sendkeys(g:buf, "echo %TESTENV%\r") + call term_sendkeys(buf, "echo %TESTENV%\r") else - call term_sendkeys(g:buf, "echo $TESTENV\r") + call term_sendkeys(buf, "echo $TESTENV\r") endif - call term_wait(g:buf) - call Stop_shell_in_terminal(g:buf) + call term_wait(buf) + call Stop_shell_in_terminal(buf) call WaitFor('getline(2) == "correct"') call assert_equal('correct', getline(2)) - exe g:buf . 'bwipe' - unlet g:buf + exe buf . 'bwipe' endfunc " must be last, we can't go back from GUI to terminal @@ -596,8 +595,7 @@ func Test_terminal_no_cmd() else call system('echo "look here" > ' . pty) endif - let g:buf = buf - call WaitFor('term_getline(g:buf, 1) =~ "look here"') + call WaitFor({-> term_getline(buf, 1) =~ "look here"}) call assert_match('look here', term_getline(buf, 1)) bwipe! @@ -677,8 +675,7 @@ func TerminalTmap(remap) call assert_equal('456', maparg('123', 't')) call assert_equal('abxde', maparg('456', 't')) call feedkeys("123", 'tx') - let g:buf = buf - call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abxde\\|456'") + call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'}) let lnum = term_getcursor(buf)[0] if a:remap call assert_match('abxde', term_getline(buf, lnum)) @@ -826,12 +823,9 @@ func Test_terminal_response_to_control_sequence() endif let buf = Run_shell_in_terminal({}) - call term_wait(buf) + call WaitFor({-> term_getline(buf, 1) != ""}) - new - call setline(1, "\x1b[6n") - write! Xescape - bwipe + call writefile(["\x1b[6n"], 'Xescape') call term_sendkeys(buf, "cat Xescape\") " wait for the response of control sequence from libvterm (and send it to tty) @@ -919,7 +913,7 @@ func Test_terminal_qall_prompt() quit endfunc -func Test_terminalopen_autocmd() +func Test_terminal_open_autocmd() augroup repro au! au TerminalOpen * let s:called += 1 diff --git a/src/version.c b/src/version.c index cdda992655..0202ede33e 100644 --- a/src/version.c +++ b/src/version.c @@ -781,6 +781,14 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1605, +/**/ + 1604, +/**/ + 1603, +/**/ + 1602, /**/ 1601, /**/