From bd8af653f96ff221fac174abbea9fdbc5529d9ac Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 5 Jun 2013 12:52:35 +0000 Subject: Fix [2100430]: ttk::entry widget index must be integer FossilOrigin-Name: 7b75c67971579578480315730aae548cccf069e6 --- ChangeLog | 4 ++++ generic/tkEntry.c | 11 ++--------- generic/ttk/ttkEntry.c | 8 ++++++++ generic/ttk/ttkScroll.c | 5 +---- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 002c0d8..5646282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * generic/ttk/ttkScroll.c: [Bug 3613759]: ttk::entry and symbolic index names. + * generic/ttk/ttkEntry.c: [Bug 2100430]: ttk::entry widget index + must be integer + * generic/tkEntry.c: Don't set interp result when it will be + overwritten later. 2013-05-19 Jan Nijtmans diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 26311a3..816b7fa 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2519,12 +2519,6 @@ GetEntryIndex( } else { badIndex: - /* - * Some of the paths here leave messages in the interp's result, - * so we have to clear it out before storing our own message. - */ - - Tcl_SetResult(interp, NULL, TCL_STATIC); Tcl_AppendResult(interp, "bad ", (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", " index \"", string, "\"", NULL); @@ -2544,7 +2538,6 @@ GetEntryIndex( } } else if (string[0] == 's') { if (entryPtr->selectFirst < 0) { - Tcl_SetResult(interp, NULL, TCL_STATIC); Tcl_AppendResult(interp, "selection isn't in widget ", Tk_PathName(entryPtr->tkwin), NULL); return TCL_ERROR; @@ -2562,7 +2555,7 @@ GetEntryIndex( } else if (string[0] == '@') { int x, roundUp, maxWidth; - if (Tcl_GetInt(interp, string + 1, &x) != TCL_OK) { + if (Tcl_GetInt(NULL, string + 1, &x) != TCL_OK) { goto badIndex; } if (x < entryPtr->inset) { @@ -2589,7 +2582,7 @@ GetEntryIndex( *indexPtr += 1; } } else { - if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) { + if (Tcl_GetInt(NULL, string, indexPtr) != TCL_OK) { goto badIndex; } if (*indexPtr < 0){ diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 5c280e4..ae43ae6 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1642,6 +1642,14 @@ static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Entry *entryPtr = recordPtr; + if (objc == 3) { + int newFirst; + if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { + return TCL_ERROR; + } + TtkScrollTo(entryPtr->entry.xscrollHandle, newFirst); + return TCL_OK; + } return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); } diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 5615eef..fc305e9 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -202,10 +202,7 @@ int TtkScrollviewCommand( Tcl_SetObjResult(interp, Tcl_NewListObj(2, result)); return TCL_OK; } else if (objc == 3) { - const char *string = Tcl_GetString(objv[2]); - if (strcmp(string, "end") == 0) { - newFirst = s->total; - } else if (Tcl_GetIntFromObj(interp, objv[2], &newFirst) != TCL_OK) { + if (Tcl_GetIntFromObj(interp, objv[2], &newFirst) != TCL_OK) { return TCL_ERROR; } } else { -- cgit v0.12