Compare commits

...

8 Commits

Author SHA1 Message Date
Yegappan Lakshmanan
bf40e90dfe patch 8.2.4538: the find_tags_in_file() function is too long
Problem:    The find_tags_in_file() function is too long.
Solution:   Refactor into smaller functions. (Yegappan Lakshmanan,
            closes #9920)
2022-03-10 18:36:54 +00:00
=?UTF-8?q?Dundar=20G=C3=B6c?=
48f83c31d1 patch 8.2.4537: output from linter and language server shows up in git
Problem:    Output from linter and language server shows up in git.
Solution:   Add patterns to .gitignore. (Goc Dundar, closes #9925)
2022-03-10 15:51:24 +00:00
Bram Moolenaar
cf6662082f patch 8.2.4536: debugger test fails when breaking on expression
Problem:    Debugger test fails when breaking on expression.
Solution:   Compare strings with "==" instead of "is".
2022-03-10 13:29:20 +00:00
Christian Brabandt
81da16b53f patch 8.2.4535: filename modifer ":8" removes the filename
Problem:    Filename modifer ":8" removes the filename.
Solution:   Use strncpy() instead of vim_strncpy(). (Christian Brabandt,
            closes #9918, closes #8600)
2022-03-10 12:24:02 +00:00
Bram Moolenaar
f8691004b0 patch 8.2.4534: Vim9: "is" operator with empty string and null returns true
Problem:    Vim9: "is" operator with empty string and null returns true.
Solution:   Consider empty string and null to be different for "is".
2022-03-10 12:20:53 +00:00
Bram Moolenaar
56b84b1728 patch 8.2.4533: Vim9: no test that after assigning null type is still checked
Problem:    Vim9: no test that after assigning null the type is still checked.
Solution:   Add a test.
2022-03-09 19:46:48 +00:00
Stuart Henderson
f2832ad965 patch 8.2.4532: suspending with CTRL-Z does not work on OpenBSD
Problem:    Suspending with CTRL-Z does not work on OpenBSD.
Solution:   Adjust #ifdef for SIGTSTP. (Stuart Henderson, closes #9912)
2022-03-09 14:33:02 +00:00
=?UTF-8?q?Dundar=20G=C3=B6c?=
f01a653ac5 patch 8.2.4531: LGTM warnings for condition and buffer size
Problem:    LGTM warnings for condition always true and buffer size too small.
Solution:   Remove the useless condition.  Make the buffer larger. (Goc
            Dundar, closes #9914)
2022-03-09 13:00:54 +00:00
14 changed files with 840 additions and 647 deletions

7
.gitignore vendored
View File

@@ -96,5 +96,10 @@ src/shadow-*
src/runtime
src/pixmaps
# other possible files build by tools
# other files possibly created by tools
src/cscope.out
# Linter/language server files
/.cache/clangd/
/.ccls-cache/
/compile_commands.json

View File

@@ -558,7 +558,7 @@ transchar_nonprint(buf_T *buf, char_u *charbuf, int c)
charbuf[1] = c ^ 0x40; // DEL displayed as ^?
charbuf[2] = NUL;
}
else if (enc_utf8 && c >= 0x80)
else if (enc_utf8)
{
transchar_hex(charbuf, c);
}

View File

@@ -989,7 +989,12 @@ debuggy_find(
}
else
{
if (typval_compare(tv, bp->dbg_val, EXPR_IS, FALSE) == OK
// Use "==" instead of "is" for strings, that is what we
// always have done.
exprtype_T type = tv->v_type == VAR_STRING
? EXPR_EQUAL : EXPR_IS;
if (typval_compare(tv, bp->dbg_val, type, FALSE) == OK
&& tv->vval.v_number == FALSE)
{
typval_T *v;

View File

@@ -186,7 +186,7 @@ shortpath_for_invalid_fname(
// unless get_short_pathname() did its work in-place.
*fname = *bufp = save_fname;
if (short_fname != save_fname)
vim_strncpy(save_fname, short_fname, len);
STRNCPY(save_fname, short_fname, len);
save_fname = NULL;
}

View File

@@ -887,8 +887,9 @@ sig_tstp SIGDEFARG(sigarg)
else
got_tstp = TRUE;
#ifndef __ANDROID__
// this is not required on all systems
#if !defined(__ANDROID__) && !defined(__OpenBSD__)
// This is not required on all systems. On some systems (at least Android
// and OpenBSD) this breaks suspending with CTRL-Z.
signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp);
#endif
SIGRETURN;

1373
src/tag.c

File diff suppressed because it is too large Load Diff

View File

@@ -6370,7 +6370,7 @@ req_codes_from_term(void)
static void
req_more_codes_from_term(void)
{
char buf[11];
char buf[23]; // extra size to shut up LGTM
int old_idx = xt_index_out;
// Don't do anything when going to exit.

View File

@@ -88,4 +88,9 @@ func Test_ColonEight_MultiByte()
call delete(dir, 'd')
endfunc
func Test_ColonEight_notexists()
let non_exists='C:\windows\newfile.txt'
call assert_equal(non_exists, fnamemodify(non_exists, ':p:8'))
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -811,11 +811,11 @@ endfunc
" Test for an unsorted tags file
func Test_tag_sort()
call writefile([
let l = [
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
\ "six\tXfoo\t2"],
\ 'Xtags')
\ "six\tXfoo\t2"]
call writefile(l, 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
@@ -826,7 +826,14 @@ func Test_tag_sort()
call assert_fails('tag first', 'E432:')
" When multiple tag files are not sorted, then message should be displayed
" multiple times
call writefile(l, 'Xtags2')
set tags=Xtags,Xtags2
call assert_fails('tag first', ['E432:', 'E432:'])
call delete('Xtags')
call delete('Xtags2')
call delete('Xfoo')
set tags&
%bwipe

View File

@@ -340,10 +340,35 @@ def Test_null_values()
var j: job = null_job
var c: channel = null_channel
endif
var d: dict<func> = {a: function('tr'), b: null_function}
END
v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_keep_type_after_assigning_null()
var lines =<< trim END
var b: blob
b = null_blob
b = 'text'
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected blob but got string')
lines =<< trim END
var l: list<number>
l = null_list
l = ['text']
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got list<string>')
lines =<< trim END
var d: dict<string>
d = null_dict
d = {a: 1, b: 2}
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got dict<number>')
enddef
def Test_skipped_assignment()
var lines =<< trim END
for x in []

View File

@@ -801,6 +801,13 @@ def Test_expr4_compare_null()
assert_false(null_string != null)
assert_false(v:null != test_null_string())
assert_false(null != null_string)
assert_true(null_string is test_null_string())
assert_false(null_string is '')
assert_false('' is null_string)
assert_false(null_string isnot test_null_string())
assert_true(null_string isnot '')
assert_true('' isnot null_string)
END
v9.CheckDefAndScriptSuccess(lines)
unlet g:null_dict

View File

@@ -1583,9 +1583,23 @@ typval_compare_string(
i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2);
switch (type)
{
case EXPR_IS:
case EXPR_IS: if (in_vim9script())
{
// Really check it is the same string, not just
// the same value.
val = tv1->vval.v_string == tv2->vval.v_string;
break;
}
// FALLTHROUGH
case EXPR_EQUAL: val = (i == 0); break;
case EXPR_ISNOT:
case EXPR_ISNOT: if (in_vim9script())
{
// Really check it is not the same string, not
// just a different value.
val = tv1->vval.v_string != tv2->vval.v_string;
break;
}
// FALLTHROUGH
case EXPR_NEQUAL: val = (i != 0); break;
case EXPR_GREATER: val = (i > 0); break;
case EXPR_GEQUAL: val = (i >= 0); break;

View File

@@ -750,6 +750,22 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4538,
/**/
4537,
/**/
4536,
/**/
4535,
/**/
4534,
/**/
4533,
/**/
4532,
/**/
4531,
/**/
4530,
/**/

View File

@@ -3313,9 +3313,8 @@ exec_instructions(ectx_T *ectx)
break;
default:
tv->v_type = VAR_STRING;
tv->vval.v_string = vim_strsave(
iptr->isn_arg.string == NULL
? (char_u *)"" : iptr->isn_arg.string);
tv->vval.v_string = iptr->isn_arg.string == NULL
? NULL : vim_strsave(iptr->isn_arg.string);
}
break;