From d0a67ec8ad6eebde787857604c064981cb8e7666 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Jan 2024 21:20:46 +0000 Subject: Restore "$menu index" to return "none" for no index (for compatibility with Tk 8.6) --- generic/tkMenu.c | 9 ++++++--- tests/menu.test | 4 ++-- tests/menuDraw.test | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/generic/tkMenu.c b/generic/tkMenu.c index d3551f9..eacdffb 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -856,12 +856,15 @@ MenuWidgetObjCmd( if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) if (index < 0) { +#if defined(TK_NO_DEPRECATED) Tcl_SetObjResult(interp, Tcl_NewObj()); - } else +#else + Tcl_SetObjResult(interp, Tcl_NewStringObj("none", TCL_INDEX_NONE)); #endif - Tcl_SetObjResult(interp, TkNewIndexObj(index)); + } else { + Tcl_SetObjResult(interp, TkNewIndexObj(index)); + } break; } case MENU_INSERT: diff --git a/tests/menu.test b/tests/menu.test index 054ac68..4e98e95 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -1864,10 +1864,10 @@ test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} - destroy .m1 } -body { menu .m1 - .m1 index "end" + expr {[.m1 index "end"] in [list {} none]} } -cleanup { destroy .m1 -} -result {} +} -result 1 test menu-4.1 {TkInvokeMenu: disabled} -setup { diff --git a/tests/menuDraw.test b/tests/menuDraw.test index 2cafc31..02111ab 100644 --- a/tests/menuDraw.test +++ b/tests/menuDraw.test @@ -558,7 +558,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup { menu .m1 .m1 add command -label "foo" -state active set tearoff [tk::TearOffMenu .m1 40 40] - expr {[$tearoff index active]<0} + expr {[$tearoff index active] in [list {} none]} } -cleanup { deleteWindows } -result 1 -- cgit v0.12 From 09b7238b270ca4ea99d22580d724901729158f7d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Jan 2024 21:21:38 +0000 Subject: typo --- tests/bell.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bell.test b/tests/bell.test index bbafeac..f1ecac4 100644 --- a/tests/bell.test +++ b/tests/bell.test @@ -28,7 +28,7 @@ test bell-1.4 {bell command} -body { test bell-1.5 {bell command} -body { bell -nice -nice -nice -} -returnCodes {ok} -result {} ;#keep -result {} and -retutnCodes {ok} for clarity? +} -returnCodes {ok} -result {} ;#keep -result {} and -returnCodes {ok} for clarity? test bell-1.6 {bell command} -body { bell -displayof . -nice -- cgit v0.12