summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpspjuth <peter.spjuth@gmail.com>2001-08-22 19:59:49 (GMT)
committerpspjuth <peter.spjuth@gmail.com>2001-08-22 19:59:49 (GMT)
commite72d91fc37cc268684a0e95f77a496e42e46032b (patch)
tree4eb55a50c29337e96d318bbf40d24ef9d80ce5fd
parentce114e255a0c035ea07b74552f8d4270b3fd998b (diff)
downloadtk-e72d91fc37cc268684a0e95f77a496e42e46032b.zip
tk-e72d91fc37cc268684a0e95f77a496e42e46032b.tar.gz
tk-e72d91fc37cc268684a0e95f77a496e42e46032b.tar.bz2
Fixed a bug where adjacent 'x' and '^' where not handled properly.
-rw-r--r--ChangeLog10
-rw-r--r--generic/tkGrid.c14
-rw-r--r--tests/grid.test30
3 files changed, 48 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index e04c0d8..6418630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-22 Peter Spjuth <peter.spjuth@space.se>
+
+ * generics/tkGrid.c (ConfigureSlaves):
+ * tests/grid.test: Fixed a bug where adjacent 'x' and '^' where
+ not handled properly. [Bug #452040]
+
2001-08-22 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkPack.c (TkParsePadAmount): added lint init for sepChar.
@@ -44,8 +50,8 @@
* doc/grid.n:
* tests/grid.test:
- * generic/tkGrid.c: Grid configure rejected initial "x" and "^"
- when the doc said it should accept them. [Bug #418664]
+ * generic/tkGrid.c: Grid configure rejected initial "x" and "^".
+ [Bug #418664]
2001-08-17 Donal K. Fellows <fellowsd@cs.man.ac.uk>
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 7fdfe19..9ac3d41 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrid.c,v 1.13 2001/08/21 20:21:36 pspjuth Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.14 2001/08/22 19:59:49 pspjuth Exp $
*/
#include "tkInt.h"
@@ -2391,6 +2391,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
int defaultColumnSpan = 1; /* default number of columns */
char *lastWindow; /* use this window to base current
* Row/col on */
+ int numSkip; /* number of 'x' found */
static char *optionStrings[] = {
"-column", "-columnspan", "-in", "-ipadx", "-ipady",
"-padx", "-pady", "-row", "-rowspan", "-sticky",
@@ -2720,16 +2721,21 @@ ConfigureSlaves(interp, tkwin, objc, objv)
/* Now look for all the "^"'s. */
lastWindow = NULL;
+ numSkip = 0;
for (j = 0; j < numWindows; j++) {
struct Gridder *otherPtr;
int match; /* found a match for the ^ */
- int lastRow, lastColumn; /* implied end of table */
+ int lastRow, lastColumn; /* implied end of table */
string = Tcl_GetString(objv[j]);
firstChar = string[0];
if (firstChar == '.') {
lastWindow = string;
+ numSkip = 0;
+ }
+ if (firstChar == REL_SKIP) {
+ numSkip++;
}
if (firstChar != REL_VERT) {
continue;
@@ -2766,6 +2772,8 @@ ConfigureSlaves(interp, tkwin, objc, objv)
lastColumn = otherPtr->column + otherPtr->numCols;
}
+ lastColumn += numSkip;
+
for (match=0, slavePtr = masterPtr->slavePtr; slavePtr != NULL;
slavePtr = slavePtr->nextPtr) {
@@ -2776,6 +2784,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
match++;
j += slavePtr->numCols - 1;
lastWindow = Tk_PathName(slavePtr->tkwin);
+ numSkip = 0;
break;
}
}
@@ -2785,7 +2794,6 @@ ConfigureSlaves(interp, tkwin, objc, objv)
(char *) NULL);
return TCL_ERROR;
}
-/* j += width - 1; */
}
if (masterPtr == NULL) {
diff --git a/tests/grid.test b/tests/grid.test
index 9e351a8..55df6c1 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -5,7 +5,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: grid.test,v 1.11 2001/08/21 20:21:36 pspjuth Exp $
+# RCS: @(#) $Id: grid.test,v 1.12 2001/08/22 19:59:49 pspjuth Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -854,6 +854,34 @@ test grid-11.15 {^ ^ test with multiple windows} {
} {{0,0 50,50} {50,0 50,100} {100,0 50,100} {0,50 50,50}}
grid_reset 11.15
+test grid-11.16 {default widget placement} {
+ foreach l {a b c d e} {
+ frame .$l -width 50 -height 50
+ }
+ grid .a .b .c .d -sticky news
+ grid x ^ x .e -sticky news
+ update
+ set res ""
+ lappend res [winfo height .a]
+ lappend res [winfo height .b]
+ lappend res [winfo height .c]
+} {50 100 50}
+grid_reset 11.16
+
+test grid-11.17 {default widget placement} {
+ foreach l {a b c d e} {
+ frame .$l -width 50 -height 50
+ }
+ grid .a .b .c .d -sticky news
+ grid ^ x ^ .e -sticky news
+ update
+ set res ""
+ lappend res [winfo height .a]
+ lappend res [winfo height .b]
+ lappend res [winfo height .c]
+} {100 50 100}
+grid_reset 11.17
+
test grid-12.1 {-sticky} {
catch {unset data}
frame .f -width 200 -height 100 -highlightthickness 0 -bg red