Skip to content

Commit 04a4b41

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 0e954ac + 0921ecf commit 04a4b41

23 files changed

+348
-60
lines changed

runtime/doc/eval.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -1801,11 +1801,13 @@ arglistid( [{winnr} [, {tabnr}]])
18011801
Number argument list id
18021802
argv( {nr}) String {nr} entry of the argument list
18031803
argv() List the argument list
1804-
assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act}
1804+
assert_equal( {exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
18051805
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
18061806
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
18071807
assert_false( {actual} [, {msg}]) none assert {actual} is false
18081808
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
1809+
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
1810+
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
18091811
assert_true( {actual} [, {msg}]) none assert {actual} is true
18101812
asin( {expr}) Float arc sine of {expr}
18111813
atan( {expr}) Float arc tangent of {expr}
@@ -2338,6 +2340,16 @@ assert_match({pattern}, {actual} [, {msg}])
23382340
< Will result in a string to be added to |v:errors|:
23392341
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
23402342

2343+
*assert_notequal()*
2344+
assert_notequal({expected}, {actual} [, {msg}])
2345+
The opposite of `assert_equal()`: add an error message to
2346+
|v:errors| when {expected} and {actual} are equal.
2347+
2348+
*assert_notmatch()*
2349+
assert_notmatch({pattern}, {actual} [, {msg}])
2350+
The opposite of `assert_match()`: add an error message to
2351+
|v:errors| when {pattern} matches {actual}.
2352+
23412353
assert_true({actual} [, {msg}]) *assert_true()*
23422354
When {actual} is not true an error message is added to
23432355
|v:errors|, like with |assert_equal()|.

runtime/doc/options.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 7.4. Last change: 2016 Mar 24
1+
*options.txt* For Vim version 7.4. Last change: 2016 Apr 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1075,7 +1075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
10751075

10761076
Note that environment variables are not expanded. If you want to use
10771077
$HOME you must expand it explicitly, e.g.: >
1078-
:let backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
1078+
:let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
10791079
10801080
< Note that the default also makes sure that "crontab -e" works (when a
10811081
backup would be made by renaming the original file crontab won't see
@@ -1258,7 +1258,7 @@ A jump table for the options with a short description can be found at |Q_op|.
12581258
break if 'linebreak' is on. Only works for ASCII and also for 8-bit
12591259
characters when 'encoding' is an 8-bit encoding.
12601260

1261-
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
1261+
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
12621262
'breakindent' 'bri' boolean (default off)
12631263
local to window
12641264
{not in Vi}
@@ -3735,6 +3735,10 @@ A jump table for the options with a short description can be found at |Q_op|.
37353735
HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
37363736
SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.
37373737
Normally you would use "cDEFAULT".
3738+
qXX - quality XX. Valid charsets are: PROOF, DRAFT,
3739+
ANTIALIASED, UNANTIALIASED, CLEARTYPE, DEFAULT.
3740+
Normally you would use "qDEFAULT".
3741+
Some quality values isn't supported in legacy OSs.
37383742

37393743
Use a ':' to separate the options.
37403744
- A '_' can be used in the place of a space, so you don't need to use

src/eval.c

+72-30
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ static void f_assert_exception(typval_T *argvars, typval_T *rettv);
476476
static void f_assert_fails(typval_T *argvars, typval_T *rettv);
477477
static void f_assert_false(typval_T *argvars, typval_T *rettv);
478478
static void f_assert_match(typval_T *argvars, typval_T *rettv);
479+
static void f_assert_notequal(typval_T *argvars, typval_T *rettv);
480+
static void f_assert_notmatch(typval_T *argvars, typval_T *rettv);
479481
static void f_assert_true(typval_T *argvars, typval_T *rettv);
480482
#ifdef FEAT_FLOAT
481483
static void f_asin(typval_T *argvars, typval_T *rettv);
@@ -2780,11 +2782,9 @@ get_lval(
27802782
if (len == -1)
27812783
{
27822784
/* "[key]": get key from "var1" */
2783-
key = get_tv_string(&var1); /* is number or string */
2784-
if (*key == NUL)
2785+
key = get_tv_string_chk(&var1); /* is number or string */
2786+
if (key == NULL)
27852787
{
2786-
if (!quiet)
2787-
EMSG(_(e_emptykey));
27882788
clear_tv(&var1);
27892789
return NULL;
27902790
}
@@ -5621,11 +5621,9 @@ eval_index(
56215621

56225622
if (len == -1)
56235623
{
5624-
key = get_tv_string(&var1);
5625-
if (*key == NUL)
5624+
key = get_tv_string_chk(&var1);
5625+
if (key == NULL)
56265626
{
5627-
if (verbose)
5628-
EMSG(_(e_emptykey));
56295627
clear_tv(&var1);
56305628
return FAIL;
56315629
}
@@ -7752,11 +7750,9 @@ get_dict_tv(char_u **arg, typval_T *rettv, int evaluate)
77527750
if (evaluate)
77537751
{
77547752
key = get_tv_string_buf_chk(&tvkey, buf);
7755-
if (key == NULL || *key == NUL)
7753+
if (key == NULL)
77567754
{
77577755
/* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */
7758-
if (key != NULL)
7759-
EMSG(_(e_emptykey));
77607756
clear_tv(&tvkey);
77617757
goto failret;
77627758
}
@@ -8182,6 +8178,8 @@ static struct fst
81828178
{"assert_fails", 1, 2, f_assert_fails},
81838179
{"assert_false", 1, 2, f_assert_false},
81848180
{"assert_match", 2, 3, f_assert_match},
8181+
{"assert_notequal", 2, 3, f_assert_notequal},
8182+
{"assert_notmatch", 2, 3, f_assert_notmatch},
81858183
{"assert_true", 1, 2, f_assert_true},
81868184
#ifdef FEAT_FLOAT
81878185
{"atan", 1, 1, f_atan},
@@ -9323,8 +9321,17 @@ f_argv(typval_T *argvars, typval_T *rettv)
93239321
alist_name(&ARGLIST[idx]), -1);
93249322
}
93259323

9324+
typedef enum
9325+
{
9326+
ASSERT_EQUAL,
9327+
ASSERT_NOTEQUAL,
9328+
ASSERT_MATCH,
9329+
ASSERT_NOTMATCH,
9330+
ASSERT_OTHER,
9331+
} assert_type_T;
9332+
93269333
static void prepare_assert_error(garray_T*gap);
9327-
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, int is_match);
9334+
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, assert_type_T is_match);
93289335
static void assert_error(garray_T *gap);
93299336
static void assert_bool(typval_T *argvars, int isTrue);
93309337

@@ -9400,7 +9407,7 @@ fill_assert_error(
94009407
char_u *exp_str,
94019408
typval_T *exp_tv,
94029409
typval_T *got_tv,
9403-
int is_match)
9410+
assert_type_T atype)
94049411
{
94059412
char_u numbuf[NUMBUFLEN];
94069413
char_u *tofree;
@@ -9412,7 +9419,7 @@ fill_assert_error(
94129419
}
94139420
else
94149421
{
9415-
if (is_match)
9422+
if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
94169423
ga_concat(gap, (char_u *)"Pattern ");
94179424
else
94189425
ga_concat(gap, (char_u *)"Expected ");
@@ -9423,8 +9430,12 @@ fill_assert_error(
94239430
}
94249431
else
94259432
ga_concat_esc(gap, exp_str);
9426-
if (is_match)
9433+
if (atype == ASSERT_MATCH)
94279434
ga_concat(gap, (char_u *)" does not match ");
9435+
else if (atype == ASSERT_NOTMATCH)
9436+
ga_concat(gap, (char_u *)" does match ");
9437+
else if (atype == ASSERT_NOTEQUAL)
9438+
ga_concat(gap, (char_u *)" differs from ");
94289439
else
94299440
ga_concat(gap, (char_u *)" but got ");
94309441
ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
@@ -9446,24 +9457,40 @@ assert_error(garray_T *gap)
94469457
list_append_string(vimvars[VV_ERRORS].vv_list, gap->ga_data, gap->ga_len);
94479458
}
94489459

9449-
/*
9450-
* "assert_equal(expected, actual[, msg])" function
9451-
*/
94529460
static void
9453-
f_assert_equal(typval_T *argvars, typval_T *rettv UNUSED)
9461+
assert_equal_common(typval_T *argvars, assert_type_T atype)
94549462
{
94559463
garray_T ga;
94569464

9457-
if (!tv_equal(&argvars[0], &argvars[1], FALSE, FALSE))
9465+
if (tv_equal(&argvars[0], &argvars[1], FALSE, FALSE)
9466+
!= (atype == ASSERT_EQUAL))
94589467
{
94599468
prepare_assert_error(&ga);
94609469
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1],
9461-
FALSE);
9470+
atype);
94629471
assert_error(&ga);
94639472
ga_clear(&ga);
94649473
}
94659474
}
94669475

9476+
/*
9477+
* "assert_equal(expected, actual[, msg])" function
9478+
*/
9479+
static void
9480+
f_assert_equal(typval_T *argvars, typval_T *rettv UNUSED)
9481+
{
9482+
assert_equal_common(argvars, ASSERT_EQUAL);
9483+
}
9484+
9485+
/*
9486+
* "assert_notequal(expected, actual[, msg])" function
9487+
*/
9488+
static void
9489+
f_assert_notequal(typval_T *argvars, typval_T *rettv UNUSED)
9490+
{
9491+
assert_equal_common(argvars, ASSERT_NOTEQUAL);
9492+
}
9493+
94679494
/*
94689495
* "assert_exception(string[, msg])" function
94699496
*/
@@ -9486,7 +9513,7 @@ f_assert_exception(typval_T *argvars, typval_T *rettv UNUSED)
94869513
{
94879514
prepare_assert_error(&ga);
94889515
fill_assert_error(&ga, &argvars[1], NULL, &argvars[0],
9489-
&vimvars[VV_EXCEPTION].vv_tv, FALSE);
9516+
&vimvars[VV_EXCEPTION].vv_tv, ASSERT_OTHER);
94909517
assert_error(&ga);
94919518
ga_clear(&ga);
94929519
}
@@ -9523,7 +9550,7 @@ f_assert_fails(typval_T *argvars, typval_T *rettv UNUSED)
95239550
{
95249551
prepare_assert_error(&ga);
95259552
fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
9526-
&vimvars[VV_ERRMSG].vv_tv, FALSE);
9553+
&vimvars[VV_ERRMSG].vv_tv, ASSERT_OTHER);
95279554
assert_error(&ga);
95289555
ga_clear(&ga);
95299556
}
@@ -9555,7 +9582,7 @@ assert_bool(typval_T *argvars, int isTrue)
95559582
prepare_assert_error(&ga);
95569583
fill_assert_error(&ga, &argvars[1],
95579584
(char_u *)(isTrue ? "True" : "False"),
9558-
NULL, &argvars[0], FALSE);
9585+
NULL, &argvars[0], ASSERT_OTHER);
95599586
assert_error(&ga);
95609587
ga_clear(&ga);
95619588
}
@@ -9570,11 +9597,8 @@ f_assert_false(typval_T *argvars, typval_T *rettv UNUSED)
95709597
assert_bool(argvars, FALSE);
95719598
}
95729599

9573-
/*
9574-
* "assert_match(pattern, actual[, msg])" function
9575-
*/
95769600
static void
9577-
f_assert_match(typval_T *argvars, typval_T *rettv UNUSED)
9601+
assert_match_common(typval_T *argvars, assert_type_T atype)
95789602
{
95799603
garray_T ga;
95809604
char_u buf1[NUMBUFLEN];
@@ -9584,16 +9608,34 @@ f_assert_match(typval_T *argvars, typval_T *rettv UNUSED)
95849608

95859609
if (pat == NULL || text == NULL)
95869610
EMSG(_(e_invarg));
9587-
else if (!pattern_match(pat, text, FALSE))
9611+
else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH))
95889612
{
95899613
prepare_assert_error(&ga);
95909614
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1],
9591-
TRUE);
9615+
atype);
95929616
assert_error(&ga);
95939617
ga_clear(&ga);
95949618
}
95959619
}
95969620

9621+
/*
9622+
* "assert_match(pattern, actual[, msg])" function
9623+
*/
9624+
static void
9625+
f_assert_match(typval_T *argvars, typval_T *rettv UNUSED)
9626+
{
9627+
assert_match_common(argvars, ASSERT_MATCH);
9628+
}
9629+
9630+
/*
9631+
* "assert_notmatch(pattern, actual[, msg])" function
9632+
*/
9633+
static void
9634+
f_assert_notmatch(typval_T *argvars, typval_T *rettv UNUSED)
9635+
{
9636+
assert_match_common(argvars, ASSERT_NOTMATCH);
9637+
}
9638+
95979639
/*
95989640
* "assert_true(actual[, msg])" function
95999641
*/

src/gui_w32.c

+8
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,7 @@ logfont2name(LOGFONT lf)
32913291
char *p;
32923292
char *res;
32933293
char *charset_name;
3294+
char *quality_name;
32943295
char *font_name = lf.lfFaceName;
32953296

32963297
charset_name = charset_id2name((int)lf.lfCharSet);
@@ -3304,6 +3305,8 @@ logfont2name(LOGFONT lf)
33043305
(char_u **)&font_name, &len);
33053306
}
33063307
#endif
3308+
quality_name = quality_id2name((int)lf.lfQuality);
3309+
33073310
res = (char *)alloc((unsigned)(strlen(font_name) + 20
33083311
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
33093312
if (res != NULL)
@@ -3331,6 +3334,11 @@ logfont2name(LOGFONT lf)
33313334
STRCAT(p, ":c");
33323335
STRCAT(p, charset_name);
33333336
}
3337+
if (quality_name != NULL)
3338+
{
3339+
STRCAT(p, ":q");
3340+
STRCAT(p, quality_name);
3341+
}
33343342
}
33353343

33363344
#ifdef FEAT_MBYTE

0 commit comments

Comments
 (0)