Skip to content

Commit c561f1d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8cd088e + 4c90861 commit c561f1d

File tree

8 files changed

+123
-109
lines changed

8 files changed

+123
-109
lines changed

runtime/tools/unicode.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ func! BuildEmojiTable(pattern, tableName)
283283
call add(alltokens, token)
284284
endif
285285

286+
" Characters below 1F000 may be considered single width traditionally,
287+
" making them double width causes problems.
288+
if first < 0x1f000
289+
continue
290+
endif
291+
286292
" exclude characters that are in the "ambiguous" or "doublewidth" table
287293
for ambi in s:ambitable
288294
if first >= ambi[0] && first <= ambi[1]

src/eval.c

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7851,10 +7851,50 @@ echo_string(
78517851
break;
78527852

78537853
case VAR_PARTIAL:
7854-
*tofree = NULL;
7855-
/* TODO: arguments */
7856-
r = tv->vval.v_partial == NULL ? NULL : tv->vval.v_partial->pt_name;
7857-
break;
7854+
{
7855+
partial_T *pt = tv->vval.v_partial;
7856+
char_u *fname = string_quote(pt == NULL ? NULL
7857+
: pt->pt_name, FALSE);
7858+
garray_T ga;
7859+
int i;
7860+
char_u *tf;
7861+
7862+
ga_init2(&ga, 1, 100);
7863+
ga_concat(&ga, (char_u *)"function(");
7864+
if (fname != NULL)
7865+
{
7866+
ga_concat(&ga, fname);
7867+
vim_free(fname);
7868+
}
7869+
if (pt != NULL && pt->pt_argc > 0)
7870+
{
7871+
ga_concat(&ga, (char_u *)", [");
7872+
for (i = 0; i < pt->pt_argc; ++i)
7873+
{
7874+
if (i > 0)
7875+
ga_concat(&ga, (char_u *)", ");
7876+
ga_concat(&ga,
7877+
tv2string(&pt->pt_argv[i], &tf, numbuf, copyID));
7878+
vim_free(tf);
7879+
}
7880+
ga_concat(&ga, (char_u *)"]");
7881+
}
7882+
if (pt != NULL && pt->pt_dict != NULL)
7883+
{
7884+
typval_T dtv;
7885+
7886+
ga_concat(&ga, (char_u *)", ");
7887+
dtv.v_type = VAR_DICT;
7888+
dtv.vval.v_dict = pt->pt_dict;
7889+
ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID));
7890+
vim_free(tf);
7891+
}
7892+
ga_concat(&ga, (char_u *)")");
7893+
7894+
*tofree = ga.ga_data;
7895+
r = *tofree;
7896+
break;
7897+
}
78587898

78597899
case VAR_LIST:
78607900
if (tv->vval.v_list == NULL)
@@ -7941,50 +7981,6 @@ tv2string(
79417981
case VAR_FUNC:
79427982
*tofree = string_quote(tv->vval.v_string, TRUE);
79437983
return *tofree;
7944-
case VAR_PARTIAL:
7945-
{
7946-
partial_T *pt = tv->vval.v_partial;
7947-
char_u *fname = string_quote(pt == NULL ? NULL
7948-
: pt->pt_name, FALSE);
7949-
garray_T ga;
7950-
int i;
7951-
char_u *tf;
7952-
7953-
ga_init2(&ga, 1, 100);
7954-
ga_concat(&ga, (char_u *)"function(");
7955-
if (fname != NULL)
7956-
{
7957-
ga_concat(&ga, fname);
7958-
vim_free(fname);
7959-
}
7960-
if (pt != NULL && pt->pt_argc > 0)
7961-
{
7962-
ga_concat(&ga, (char_u *)", [");
7963-
for (i = 0; i < pt->pt_argc; ++i)
7964-
{
7965-
if (i > 0)
7966-
ga_concat(&ga, (char_u *)", ");
7967-
ga_concat(&ga,
7968-
tv2string(&pt->pt_argv[i], &tf, numbuf, copyID));
7969-
vim_free(tf);
7970-
}
7971-
ga_concat(&ga, (char_u *)"]");
7972-
}
7973-
if (pt != NULL && pt->pt_dict != NULL)
7974-
{
7975-
typval_T dtv;
7976-
7977-
ga_concat(&ga, (char_u *)", ");
7978-
dtv.v_type = VAR_DICT;
7979-
dtv.vval.v_dict = pt->pt_dict;
7980-
ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID));
7981-
vim_free(tf);
7982-
}
7983-
ga_concat(&ga, (char_u *)")");
7984-
7985-
*tofree = ga.ga_data;
7986-
return *tofree;
7987-
}
79887984
case VAR_STRING:
79897985
*tofree = string_quote(tv->vval.v_string, FALSE);
79907986
return *tofree;
@@ -7997,6 +7993,7 @@ tv2string(
79977993
case VAR_NUMBER:
79987994
case VAR_LIST:
79997995
case VAR_DICT:
7996+
case VAR_PARTIAL:
80007997
case VAR_SPECIAL:
80017998
case VAR_JOB:
80027999
case VAR_CHANNEL:
@@ -19285,7 +19282,8 @@ f_string(typval_T *argvars, typval_T *rettv)
1928519282
char_u numbuf[NUMBUFLEN];
1928619283

1928719284
rettv->v_type = VAR_STRING;
19288-
rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, 0);
19285+
rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf,
19286+
get_copyID());
1928919287
/* Make a copy if we have a value but it's not in allocated memory. */
1929019288
if (rettv->vval.v_string != NULL && tofree == NULL)
1929119289
rettv->vval.v_string = vim_strsave(rettv->vval.v_string);
@@ -23484,7 +23482,8 @@ ex_function(exarg_T *eap)
2348423482
else
2348523483
arg = fudi.fd_newkey;
2348623484
if (arg != NULL && (fudi.fd_di == NULL
23487-
|| fudi.fd_di->di_tv.v_type != VAR_FUNC))
23485+
|| (fudi.fd_di->di_tv.v_type != VAR_FUNC
23486+
&& fudi.fd_di->di_tv.v_type != VAR_PARTIAL)))
2348823487
{
2348923488
if (*arg == K_SPECIAL)
2349023489
j = 3;
@@ -26467,8 +26466,10 @@ modify_fname(
2646726466
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S')
2646826467
{
2646926468
/* vim_strsave_shellescape() needs a NUL terminated string. */
26469+
c = (*fnamep)[*fnamelen];
2647026470
(*fnamep)[*fnamelen] = NUL;
2647126471
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
26472+
(*fnamep)[*fnamelen] = c;
2647226473
if (p == NULL)
2647326474
return -1;
2647426475
vim_free(*bufp);

src/if_py_both.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6032,13 +6032,26 @@ ConvertToPyObject(typval_T *tv)
60326032
case VAR_FUNC:
60336033
return NEW_FUNCTION(tv->vval.v_string == NULL
60346034
? (char_u *)"" : tv->vval.v_string);
6035+
case VAR_PARTIAL:
6036+
return NEW_FUNCTION(tv->vval.v_partial == NULL
6037+
? (char_u *)"" : tv->vval.v_partial->pt_name);
60356038
case VAR_UNKNOWN:
6039+
case VAR_CHANNEL:
6040+
case VAR_JOB:
60366041
Py_INCREF(Py_None);
60376042
return Py_None;
6038-
default:
6043+
case VAR_SPECIAL:
6044+
switch (tv->vval.v_number)
6045+
{
6046+
case VVAL_FALSE: return AlwaysFalse(NULL);
6047+
case VVAL_TRUE: return AlwaysTrue(NULL);
6048+
case VVAL_NONE:
6049+
case VVAL_NULL: return AlwaysNone(NULL);
6050+
}
60396051
PyErr_SET_VIM(N_("internal error: invalid value type"));
60406052
return NULL;
60416053
}
6054+
return NULL;
60426055
}
60436056

60446057
typedef struct

src/mbyte.c

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,64 +1445,6 @@ utf_char2cells(int c)
14451445
* based on http://unicode.org/emoji/charts/emoji-list.html */
14461446
static struct interval emoji_width[] =
14471447
{
1448-
{0x203c, 0x203c},
1449-
{0x2049, 0x2049},
1450-
{0x2139, 0x2139},
1451-
{0x21a9, 0x21aa},
1452-
{0x231a, 0x231b},
1453-
{0x2328, 0x2328},
1454-
{0x23cf, 0x23cf},
1455-
{0x23e9, 0x23f3},
1456-
{0x25aa, 0x25ab},
1457-
{0x25fb, 0x25fe},
1458-
{0x2600, 0x2604},
1459-
{0x2611, 0x2611},
1460-
{0x2618, 0x2618},
1461-
{0x261d, 0x261d},
1462-
{0x2620, 0x2620},
1463-
{0x2622, 0x2623},
1464-
{0x2626, 0x2626},
1465-
{0x262a, 0x262a},
1466-
{0x262e, 0x262f},
1467-
{0x2638, 0x263a},
1468-
{0x2648, 0x2653},
1469-
{0x2666, 0x2666},
1470-
{0x267b, 0x267b},
1471-
{0x267f, 0x267f},
1472-
{0x2692, 0x2694},
1473-
{0x2696, 0x2697},
1474-
{0x2699, 0x2699},
1475-
{0x269b, 0x269c},
1476-
{0x26a0, 0x26a1},
1477-
{0x26aa, 0x26ab},
1478-
{0x26b0, 0x26b1},
1479-
{0x26bd, 0x26bd},
1480-
{0x26ce, 0x26ce},
1481-
{0x2702, 0x2702},
1482-
{0x2705, 0x2705},
1483-
{0x2708, 0x270d},
1484-
{0x270f, 0x270f},
1485-
{0x2712, 0x2712},
1486-
{0x2714, 0x2714},
1487-
{0x2716, 0x2716},
1488-
{0x271d, 0x271d},
1489-
{0x2721, 0x2721},
1490-
{0x2728, 0x2728},
1491-
{0x2733, 0x2734},
1492-
{0x2744, 0x2744},
1493-
{0x2747, 0x2747},
1494-
{0x274c, 0x274c},
1495-
{0x274e, 0x274e},
1496-
{0x2753, 0x2755},
1497-
{0x2763, 0x2764},
1498-
{0x2795, 0x2797},
1499-
{0x27a1, 0x27a1},
1500-
{0x27b0, 0x27b0},
1501-
{0x27bf, 0x27bf},
1502-
{0x2934, 0x2935},
1503-
{0x2b05, 0x2b07},
1504-
{0x2b1b, 0x2b1c},
1505-
{0x2b50, 0x2b50},
15061448
{0x1f004, 0x1f004},
15071449
{0x1f0cf, 0x1f0cf},
15081450
{0x1f1e6, 0x1f1ff},

src/testdir/test105.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ STARTTEST
3636
:Put fnamemodify('abc''%''def', ':S' )
3737
:Put fnamemodify("abc\ndef", ':S' )
3838
:Put expand('%:r:S') == shellescape(expand('%:r'))
39+
:Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',')
3940
:set shell=tcsh
4041
:Put fnamemodify("abc\ndef", ':S' )
4142
:$put ='vim: ts=8'

src/testdir/test105.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
2626
fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
2727
fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
2828
expand('%:r:S') == shellescape(expand('%:r')) 1
29+
join([expand('%:r'), expand('%:r:S'), expand('%')], ',') 'test105,''test105'',test105.in'
2930
fnamemodify("abc\ndef", ':S' ) '''abc\^@def'''
3031
vim: ts=8

src/testdir/test_partial.vim

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,43 @@ func Test_func_unref()
180180
unlet obj
181181
call assert_false(exists('*{' . funcnumber . '}'))
182182
endfunc
183+
184+
func Test_tostring()
185+
let d = {}
186+
let d.d = d
187+
function d.test3()
188+
echo 42
189+
endfunction
190+
try
191+
call string(d.test3)
192+
catch
193+
call assert_true(v:false, v:exception)
194+
endtry
195+
endfunc
196+
197+
func Test_redefine_dict_func()
198+
let d = {}
199+
function d.test4()
200+
endfunction
201+
let d.test4 = d.test4
202+
try
203+
function! d.test4(name)
204+
endfunction
205+
catch
206+
call assert_true(v:errmsg, v:exception)
207+
endtry
208+
endfunc
209+
210+
func Test_bind_in_python()
211+
if has('python')
212+
let g:d = {}
213+
function g:d.test2()
214+
endfunction
215+
python import vim
216+
try
217+
call assert_equal(pyeval('vim.bindeval("g:d.test2")'), g:d.test2)
218+
catch
219+
call assert_true(v:false, v:exception)
220+
endtry
221+
endif
222+
endfunc

src/version.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,16 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
1646,
768+
/**/
769+
1645,
770+
/**/
771+
1644,
772+
/**/
773+
1643,
774+
/**/
775+
1642,
766776
/**/
767777
1641,
768778
/**/

0 commit comments

Comments
 (0)