From 67231dc888748cd3ed4fa4baf288aa9fedcea526 Mon Sep 17 00:00:00 2001 From: edyfox Date: Sun, 29 Jun 2008 08:31:21 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1087 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/charset.c | 14 ++++++++------ src/eval.c | 24 ++++++++++++++---------- src/message.c | 2 ++ src/version.c | 6 ++++++ 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/charset.c b/src/charset.c index 282e8573..0c9c5113 100644 --- a/src/charset.c +++ b/src/charset.c @@ -449,13 +449,15 @@ str_foldcase(str, orglen, buf, buflen) { if (enc_utf8) { - int c, lc; - - c = utf_ptr2char(STR_PTR(i)); - lc = utf_tolower(c); - if (c != lc) + int c = utf_ptr2char(STR_PTR(i)); + int ol = utf_ptr2len(STR_PTR(i)); + int lc = utf_tolower(c); + + /* Only replace the character when it is not an invalid + * sequence (ASCII character or more than one byte) and + * utf_tolower() doesn't return the original character. */ + if ((c < 0x80 || ol > 1) && c != lc) { - int ol = utf_char2len(c); int nl = utf_char2len(lc); /* If the byte length changes need to shift the following diff --git a/src/eval.c b/src/eval.c index 3994b172..e4024986 100644 --- a/src/eval.c +++ b/src/eval.c @@ -405,8 +405,8 @@ static int eval2 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static int eval3 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static int eval4 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static int eval5 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval6 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval7 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); +static int eval6 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string)); +static int eval7 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string)); static int eval_index __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose)); static int get_option_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); @@ -4458,7 +4458,7 @@ eval5(arg, rettv, evaluate) /* * Get the first variable. */ - if (eval6(arg, rettv, evaluate) == FAIL) + if (eval6(arg, rettv, evaluate, FALSE) == FAIL) return FAIL; /* @@ -4494,7 +4494,7 @@ eval5(arg, rettv, evaluate) * Get the second variable. */ *arg = skipwhite(*arg + 1); - if (eval6(arg, &var2, evaluate) == FAIL) + if (eval6(arg, &var2, evaluate, op == '.') == FAIL) { clear_tv(rettv); return FAIL; @@ -4624,10 +4624,11 @@ eval5(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval6(arg, rettv, evaluate) +eval6(arg, rettv, evaluate, want_string) char_u **arg; typval_T *rettv; int evaluate; + int want_string; /* after "." operator */ { typval_T var2; int op; @@ -4641,7 +4642,7 @@ eval6(arg, rettv, evaluate) /* * Get the first variable. */ - if (eval7(arg, rettv, evaluate) == FAIL) + if (eval7(arg, rettv, evaluate, want_string) == FAIL) return FAIL; /* @@ -4676,7 +4677,7 @@ eval6(arg, rettv, evaluate) * Get the second variable. */ *arg = skipwhite(*arg + 1); - if (eval7(arg, &var2, evaluate) == FAIL) + if (eval7(arg, &var2, evaluate, FALSE) == FAIL) return FAIL; if (evaluate) @@ -4790,10 +4791,11 @@ eval6(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval7(arg, rettv, evaluate) +eval7(arg, rettv, evaluate, want_string) char_u **arg; typval_T *rettv; int evaluate; + int want_string; /* after "." operator */ { long n; int len; @@ -4838,8 +4840,10 @@ eval7(arg, rettv, evaluate) /* We accept a float when the format matches * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very - * strict to avoid backwards compatibility problems. */ - if (p[0] == '.' && vim_isdigit(p[1])) + * strict to avoid backwards compatibility problems. + * Don't look for a float after the "." operator, so that + * ":let vers = 1.2.3" doesn't fail. */ + if (!want_string && p[0] == '.' && vim_isdigit(p[1])) { get_float = TRUE; p = skipdigits(p + 2); diff --git a/src/message.c b/src/message.c index 8387d936..66936cda 100644 --- a/src/message.c +++ b/src/message.c @@ -3905,6 +3905,8 @@ tv_float(tvs, idxp) ++*idxp; if (tvs[idx].v_type == VAR_FLOAT) f = tvs[idx].vval.v_float; + else if (tvs[idx].v_type == VAR_NUMBER) + f = tvs[idx].vval.v_number; else EMSG(_("E807: Expected Float argument for printf()")); } diff --git a/src/version.c b/src/version.c index 95d6d54f..93b79578 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,12 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 8, +/**/ + 7, +/**/ + 6, +/**/ 5, /**/ 4, -- 2.11.4.GIT