Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Jun 3, 2024
2 parents ec1b1d8 + c5a5c54 commit 3a773b7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion generic/ttk/ttkManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ int Ttk_GetContentIndexFromObj(
*/
if (index < 0 || (index - !!lastOK) >= mgr->nContent) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Managed window index %d out of bounds", (int)index));
"Managed window index \"%s\" out of bounds", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL);
return TCL_ERROR;
}
Expand Down
14 changes: 7 additions & 7 deletions generic/ttk/ttkNotebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ static void TabrowSize(

Ttk_RebindSublayout(tabLayout, tab);
Ttk_LayoutSize(tabLayout,tabState,&tab->width,&tab->height);
tab->width = MAX(tab->width, minTabWidth);
tab->width = MAX(tab->width, minTabWidth);

if (orient == TTK_ORIENT_HORIZONTAL) {
tabrowHeight = MAX(tabrowHeight, tab->height);
Expand Down Expand Up @@ -890,14 +890,14 @@ static int GetTabIndex(
int status = FindTabIndex(interp, nb, objPtr, index_rtn);
if (status == TCL_OK && *index_rtn >= Ttk_NumberContent(nb->notebook.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"tab index %s out of bounds", Tcl_GetString(objPtr)));
"Tab index \"%s\" out of bounds", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL);
return TCL_ERROR;
}

if (status == TCL_OK && *index_rtn < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"tab '%s' not found", Tcl_GetString(objPtr)));
"Tab '%s' not found", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "TAB", NULL);
status = TCL_ERROR;
}
Expand Down Expand Up @@ -1072,7 +1072,7 @@ static int NotebookHideCommand(
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
} else {
TtkRedisplayWidget(&nb->core);
TtkRedisplayWidget(&nb->core);
}

return TCL_OK;
Expand Down Expand Up @@ -1153,9 +1153,9 @@ static int NotebookIndexCommand(

status = FindTabIndex(interp, nb, objv[2], &index);
if (status == TCL_OK) {
if (index >= 0) {
Tcl_SetObjResult(interp, TkNewIndexObj(index));
}
if (index >= 0) {
Tcl_SetObjResult(interp, TkNewIndexObj(index));
}
}

return status;
Expand Down
68 changes: 34 additions & 34 deletions generic/ttk/ttkTreeview.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ static TreeColumn *GetColumn(
return tv->tree.columns + columnIndex;
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Invalid column index %s", Tcl_GetString(columnIDObj)));
"Invalid column index \"%s\"", Tcl_GetString(columnIDObj)));
Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN", NULL);
return NULL;
}
Expand Down Expand Up @@ -1382,16 +1382,16 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
CellSelectionClear(tv);
}
if (tv->tree.nTitleColumns < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"#%" TCL_SIZE_MODIFIER "d\" is out of range",
tv->tree.nTitleColumns));
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"#%" TCL_SIZE_MODIFIER "d\" is out of range",
tv->tree.nTitleColumns));
Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLECOLUMNS", NULL);
return TCL_ERROR;
}
if (tv->tree.nTitleItems < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%" TCL_SIZE_MODIFIER "d\" is out of range",
tv->tree.nTitleItems));
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%" TCL_SIZE_MODIFIER "d\" is out of range",
tv->tree.nTitleItems));
Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLEITEMS", NULL);
return TCL_ERROR;
}
Expand Down Expand Up @@ -1541,10 +1541,10 @@ static int ConfigureColumn(
if (mask & GEOMETRY_CHANGED) {
if (!Tk_IsMapped(tv->core.tkwin)) {
TtkResizeWidget(&tv->core);
} else {
} else {
RecomputeSlack(tv);
ResizeColumns(tv, TreeWidth(tv));
}
}
}
TtkRedisplayWidget(&tv->core);

Expand Down Expand Up @@ -1974,13 +1974,13 @@ static void TreeviewDoLayout(void *clientData)
last = tv->tree.yscroll.first + visibleRows - tv->tree.titleRows;
total = tv->tree.totalRows - tv->tree.titleRows;
if (tv->tree.treeArea.height % tv->tree.rowHeight) {
/* When the treeview height doesn't correspond to an exact number
* of rows, the last row count must be incremented to draw a
* partial row at the bottom. The total row count must also be
* incremented to be able to scroll all the way to the bottom.
*/
last++;
total++;
/* When the treeview height doesn't correspond to an exact number
* of rows, the last row count must be incremented to draw a
* partial row at the bottom. The total row count must also be
* incremented to be able to scroll all the way to the bottom.
*/
last++;
total++;
}
TtkScrolled(tv->tree.yscrollHandle, first, last, total);
}
Expand Down Expand Up @@ -2332,7 +2332,7 @@ static void DrawItem(
displayItemUsed);
}

displayItem.anchorObj = tv->tree.column0.anchorObj;
displayItem.anchorObj = tv->tree.column0.anchorObj;
Tk_GetAnchorFromObj(NULL, column->anchorObj, &textAnchor);
displayItemUsed->textObj = item->textObj;
/* Item's image can be null, and may come from the tag */
Expand Down Expand Up @@ -2392,7 +2392,7 @@ static void DrawForest(
Treeview *tv, TreeItem *item, Drawable d, int depth)
{
while (item) {
DrawSubtree(tv, item, d, depth);
DrawSubtree(tv, item, d, depth);
item = item->next;
}
}
Expand Down Expand Up @@ -2804,8 +2804,8 @@ static int TreeviewHorribleIdentify(

BoundingBox(tv, item, NULL, &itemBox);
PrepareItem(tv, item, &displayItem, state);
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, state, itemBox);
element = Ttk_IdentifyElement(layout, x, y);
Expand Down Expand Up @@ -2862,7 +2862,7 @@ static int TreeviewIdentifyCommand(

if (Tcl_GetIndexFromObjStruct(interp, objv[2], submethodStrings,
sizeof(char *), "command", TCL_EXACT, &submethod) != TCL_OK
|| Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &x) != TCL_OK
|| Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &x) != TCL_OK
|| Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[4], &y) != TCL_OK
) {
return TCL_ERROR;
Expand Down Expand Up @@ -2932,8 +2932,8 @@ static int TreeviewIdentifyCommand(
}
state = ItemState(tv, item);
PrepareItem(tv, item, &displayItem, state);
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, state, bbox);
element = Ttk_IdentifyElement(layout, x, y);
Expand Down Expand Up @@ -3342,9 +3342,9 @@ static int TreeviewDeleteCommand(
*/
delq = 0;
for (i = 0; items[i]; ++i) {
if (items[i]->state & TTK_STATE_SELECTED) {
selChange = 1;
} else if (items[i]->selObj != NULL) {
if (items[i]->state & TTK_STATE_SELECTED) {
selChange = 1;
} else if (items[i]->selObj != NULL) {
Tcl_Size length;
Tcl_ListObjLength(interp, items[i]->selObj, &length);
if (length > 0) {
Expand All @@ -3368,7 +3368,7 @@ static int TreeviewDeleteCommand(

ckfree(items);
if (selChange) {
Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
}
tv->tree.rowPosNeedsUpdate = 1;
TtkRedisplayWidget(&tv->core);
Expand Down Expand Up @@ -4037,7 +4037,7 @@ static int TreeviewTagDeleteCommand(
tag = Ttk_GetTagFromObj(tagTable, objv[3]);
/* remove the tag from all cells and items */
while (item) {
RemoveTagFromCellsAtItem(item, tag);
RemoveTagFromCellsAtItem(item, tag);
RemoveTag(item, tag);
item = NextPreorder(item);
}
Expand Down Expand Up @@ -4285,9 +4285,9 @@ static void RemoveTagFromCellsAtItem(TreeItem *item, Ttk_Tag tag)
Tcl_Size i;

for (i = 0; i < item->nTagSets; i++) {
if (item->cellTagSets[i] != NULL) {
Ttk_TagSetRemove(item->cellTagSets[i], tag);
}
if (item->cellTagSets[i] != NULL) {
Ttk_TagSetRemove(item->cellTagSets[i], tag);
}
}
}

Expand Down Expand Up @@ -4366,7 +4366,7 @@ static int TreeviewCtagRemoveCommand(
} else {
item = tv->tree.root;
while (item) {
RemoveTagFromCellsAtItem(item, tag);
RemoveTagFromCellsAtItem(item, tag);
item = NextPreorder(item);
}
}
Expand Down Expand Up @@ -4400,7 +4400,7 @@ static const Ttk_Ensemble TreeviewTagCommands[] = {
*/
static const Ttk_Ensemble TreeviewCommands[] = {
{ "bbox", TreeviewBBoxCommand,0 },
{ "cellselection" , TreeviewCellSelectionCommand,0 },
{ "cellselection", TreeviewCellSelectionCommand,0 },
{ "children", TreeviewChildrenCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
{ "column", TreeviewColumnCommand,0 },
Expand All @@ -4423,7 +4423,7 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "parent", TreeviewParentCommand,0 },
{ "prev", TreeviewPrevCommand,0 },
{ "see", TreeviewSeeCommand,0 },
{ "selection" , TreeviewSelectionCommand,0 },
{ "selection", TreeviewSelectionCommand,0 },
{ "set", TreeviewSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "style", TtkWidgetStyleCommand,0 },
Expand Down
4 changes: 2 additions & 2 deletions tests/ttk/notebook.test
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ test notebook-9.1 "move last tab by numerical index" -body {
.n insert 0 3 ; # not allowed: position 3 is after last tab
} -cleanup {
destroy .n
} -result {Managed window index 3 out of bounds} -returnCodes error
} -result {Managed window index "3" out of bounds} -returnCodes error
test notebook-9.2 "move first tab to last position by numerical index" -body {
::ttk::notebook .n
foreach tabs {TabA TabB TabC} {
Expand All @@ -574,6 +574,6 @@ test notebook-9.2 "move first tab to last position by numerical index" -body {
.n insert 3 0 ; # not allowed: position 3 is after last tab
} -cleanup {
destroy .n
} -result {Managed window index 3 out of bounds} -returnCodes error
} -result {Managed window index "3" out of bounds} -returnCodes error

tcltest::cleanupTests
8 changes: 4 additions & 4 deletions tests/ttk/panedwindow.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ test panedwindow-1.0 "Setup" -body {

test panedwindow-1.0.1 "Make sure pane 0 command doesn't crash on empty pane - bug e6140f3404" -body {
.pw pane 0
} -result {Managed window index 0 out of bounds} -returnCodes error
} -result {Managed window index "0" out of bounds} -returnCodes error

test panedwindow-1.0.2 "Make sure pane end command doesn't crash on empty pane - bug e6140f3404" -body {
.pw pane end
} -result {Managed window index -1 out of bounds} -returnCodes error
} -result {Managed window index "end" out of bounds} -returnCodes error

test panedwindow-1.0.3 "Make sure forget 0 command doesn't crash on empty pane - bug e6140f3404" -body {
.pw forget 0
} -result {Managed window index 0 out of bounds} -returnCodes error
} -result {Managed window index "0" out of bounds} -returnCodes error

test panedwindow-1.0.4 "Make sure forget end command doesn't crash on empty pane - bug e6140f3404" -body {
.pw forget end
} -result {Managed window index -1 out of bounds} -returnCodes error
} -result {Managed window index "end" out of bounds} -returnCodes error

test panedwindow-1.1 "Make sure empty panedwindow doesn't crash" -body {
pack .pw -expand true -fill both
Expand Down
4 changes: 2 additions & 2 deletions tests/ttk/treeview.test
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test treeview-1.2 "Bad columns" -body {

test treeview-1.3 "bad displaycolumns" -body {
.tv configure -displaycolumns {a b d}
} -returnCodes error -result "Invalid column index d"
} -returnCodes error -result {Invalid column index "d"}

test treeview-1.4 "more bad displaycolumns" -body {
.tv configure -displaycolumns {1 2 3}
Expand Down Expand Up @@ -860,7 +860,7 @@ test treeview-11.13 "Cellselection - error" -body {

test treeview-11.14 "Cellselection - error" -body {
.tv cellselection set [list "nn xx "]
} -returnCodes 1 -match glob -result {Invalid column index xx}
} -returnCodes 1 -match glob -result {Invalid column index "xx"}

test treeview-11.15 "Cellselection - error" -body {
.tv cellselection set "nn c" "nn d"
Expand Down

0 comments on commit 3a773b7

Please sign in to comment.