mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+15
-12
@@ -3737,24 +3737,27 @@ do_unlet(name, forceit)
|
||||
ht = find_var_ht(name, &varname);
|
||||
if (ht != NULL && *varname != NUL)
|
||||
{
|
||||
if (ht == &globvarht)
|
||||
d = &globvardict;
|
||||
else if (current_funccal != NULL
|
||||
&& ht == ¤t_funccal->l_vars.dv_hashtab)
|
||||
d = ¤t_funccal->l_vars;
|
||||
else
|
||||
{
|
||||
di = find_var_in_ht(ht, *name, (char_u *)"", FALSE);
|
||||
d = di->di_tv.vval.v_dict;
|
||||
}
|
||||
hi = hash_find(ht, varname);
|
||||
if (!HASHITEM_EMPTY(hi))
|
||||
{
|
||||
di = HI2DI(hi);
|
||||
if (var_check_fixed(di->di_flags, name, FALSE)
|
||||
|| var_check_ro(di->di_flags, name, FALSE)
|
||||
|| tv_check_lock(d->dv_lock, name, FALSE))
|
||||
|| var_check_ro(di->di_flags, name, FALSE))
|
||||
return FAIL;
|
||||
|
||||
if (ht == &globvarht)
|
||||
d = &globvardict;
|
||||
else if (current_funccal != NULL
|
||||
&& ht == ¤t_funccal->l_vars.dv_hashtab)
|
||||
d = ¤t_funccal->l_vars;
|
||||
else
|
||||
{
|
||||
di = find_var_in_ht(ht, *name, (char_u *)"", FALSE);
|
||||
d = di->di_tv.vval.v_dict;
|
||||
}
|
||||
if (d == NULL || tv_check_lock(d->dv_lock, name, FALSE))
|
||||
return FAIL;
|
||||
|
||||
delete_var(ht, hi);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -6974,7 +6974,9 @@ cursor_pos_info(dict)
|
||||
char_u buf2[40];
|
||||
linenr_T lnum;
|
||||
long byte_count = 0;
|
||||
#ifdef FEAT_MBYTE
|
||||
long bom_count = 0;
|
||||
#endif
|
||||
long byte_count_cursor = 0;
|
||||
long char_count = 0;
|
||||
long char_count_cursor = 0;
|
||||
@@ -7190,15 +7192,15 @@ cursor_pos_info(dict)
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't shorten this message, the user asked for it. */
|
||||
#ifdef FEAT_MBYTE
|
||||
bom_count = bomb_size();
|
||||
if (bom_count > 0)
|
||||
sprintf((char *)IObuff + STRLEN(IObuff), _("(+%ld for BOM)"),
|
||||
bom_count);
|
||||
vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE,
|
||||
_("(+%ld for BOM)"), bom_count);
|
||||
#endif
|
||||
if (dict == NULL)
|
||||
{
|
||||
/* Don't shorten this message, the user asked for it. */
|
||||
p = p_shm;
|
||||
p_shm = (char_u *)"";
|
||||
msg(IObuff);
|
||||
@@ -7210,19 +7212,17 @@ cursor_pos_info(dict)
|
||||
{
|
||||
dict_add_nr_str(dict, "words", (long)word_count, NULL);
|
||||
dict_add_nr_str(dict, "chars", (long)char_count, NULL);
|
||||
dict_add_nr_str(dict, "bytes", (long)byte_count + bom_count, NULL);
|
||||
if (VIsual_active)
|
||||
{
|
||||
dict_add_nr_str(dict, "visual_bytes", (long)byte_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, "visual_chars", (long)char_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, "visual_words", (long)word_count_cursor, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
dict_add_nr_str(dict, "cursor_bytes", (long)byte_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, "cursor_chars", (long)char_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, "cursor_words", (long)word_count_cursor, NULL);
|
||||
}
|
||||
dict_add_nr_str(dict, "bytes", (long)byte_count
|
||||
# ifdef FEAT_MBYTE
|
||||
+ bom_count
|
||||
# endif
|
||||
, NULL);
|
||||
dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
|
||||
(long)byte_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars",
|
||||
(long)char_count_cursor, NULL);
|
||||
dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words",
|
||||
(long)word_count_cursor, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,3 +8,4 @@ source test_searchpos.vim
|
||||
source test_set.vim
|
||||
source test_sort.vim
|
||||
source test_undolevels.vim
|
||||
source test_unlet.vim
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
" Tests for :unlet
|
||||
|
||||
func Test_read_only()
|
||||
try
|
||||
" this caused a crash
|
||||
unlet count
|
||||
catch
|
||||
call assert_true(v:exception =~ ':E795:')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_existing()
|
||||
let does_exist = 1
|
||||
call assert_true(exists('does_exist'))
|
||||
unlet does_exist
|
||||
call assert_false(exists('does_exist'))
|
||||
endfunc
|
||||
|
||||
func Test_not_existing()
|
||||
unlet! does_not_exist
|
||||
try
|
||||
unlet does_not_exist
|
||||
catch
|
||||
call assert_true(v:exception =~ ':E108:')
|
||||
endtry
|
||||
endfunc
|
||||
@@ -4,6 +4,7 @@ STARTTEST
|
||||
:so small.vim
|
||||
:so mbyte.vim
|
||||
:set enc=utf8
|
||||
:set selection=inclusive fileformat=unix fileformats=unix
|
||||
:new
|
||||
:fu DoRecordWin(...)
|
||||
: wincmd k
|
||||
|
||||
@@ -756,6 +756,16 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1051,
|
||||
/**/
|
||||
1050,
|
||||
/**/
|
||||
1049,
|
||||
/**/
|
||||
1048,
|
||||
/**/
|
||||
1047,
|
||||
/**/
|
||||
1046,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user