changeset 23424:c0880eafe162 v8.2.2255

patch 8.2.2255: Tcl test fails Commit: https://github.com/vim/vim/commit/1779ff48427931736998a6e5621b5cbe4d99c3e3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 31 18:11:16 2020 +0100 patch 8.2.2255: Tcl test fails Problem: Tcl test fails. Solution: Change option handling.
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Dec 2020 18:15:03 +0100
parents 7481358c00ed
children a3c77a2e53b6
files src/if_tcl.c src/version.c
diffstat 2 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_tcl.c
+++ b/src/if_tcl.c
@@ -1281,7 +1281,7 @@ tclsetoption(
 {
     int		err, nobjs, idx;
     char_u	*option;
-    int		isnum;
+    getoption_T	gov;
     long	lval;
     char_u	*sval;
     Tcl_Obj	*resobj;
@@ -1298,15 +1298,16 @@ tclsetoption(
 
     option = (char_u *)Tcl_GetStringFromObj(objv[objn], NULL);
     ++objn;
-    isnum = get_option_value(option, &lval, &sval, 0);
+    gov = get_option_value(option, &lval, &sval, 0);
     err = TCL_OK;
-    switch (isnum)
+    switch (gov)
     {
-	case 0:
+	case gov_string:
 	    Tcl_SetResult(interp, (char *)sval, TCL_VOLATILE);
 	    vim_free(sval);
 	    break;
-	case 1:
+	case gov_bool:
+	case gov_number:
 	    resobj = Tcl_NewLongObj(lval);
 	    Tcl_SetObjResult(interp, resobj);
 	    break;
@@ -1316,7 +1317,7 @@ tclsetoption(
     }
     if (nobjs == 2)
     {
-	if (isnum)
+	if (gov != gov_string)
 	{
 	    sval = NULL;    // avoid compiler warning
 	    err = Tcl_GetIndexFromObj(interp, objv[objn], optkw, "", 0, &idx);
@@ -1326,17 +1327,19 @@ tclsetoption(
 		err = Tcl_GetLongFromObj(interp, objv[objn], &lval);
 	    }
 	    else
-	    switch (idx)
 	    {
-		case OPT_ON:
-		    lval = 1;
-		    break;
-		case OPT_OFF:
-		    lval = 0;
-		    break;
-		case OPT_TOGGLE:
-		    lval = !lval;
-		    break;
+		switch (idx)
+		{
+		    case OPT_ON:
+			lval = 1;
+			break;
+		    case OPT_OFF:
+			lval = 0;
+			break;
+		    case OPT_TOGGLE:
+			lval = !lval;
+			break;
+		}
 	    }
 	}
 	else
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2255,
+/**/
     2254,
 /**/
     2253,