summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-17 11:51:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-17 11:51:24 (GMT)
commit2ccfe270199b3930be69190d889647d586575736 (patch)
tree04d43c577fc7f4fc89e2cf1d64cb8a6a726902a2
parent6f859f6417c512b043b73a4ccf3ef3e0a5c3b4bb (diff)
downloadtk-2ccfe270199b3930be69190d889647d586575736.zip
tk-2ccfe270199b3930be69190d889647d586575736.tar.gz
tk-2ccfe270199b3930be69190d889647d586575736.tar.bz2
Fix [026e2bb685]: text tag sets bad relief, gets error, but bad relief is saved anyway. Let TIP #613 handle it all.
-rw-r--r--generic/tkText.c16
-rw-r--r--generic/tkText.h47
-rw-r--r--generic/tkTextDisp.c14
-rw-r--r--generic/tkTextTag.c128
-rw-r--r--tests/textTag.test16
5 files changed, 88 insertions, 133 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 66676f0..2399a33 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -628,6 +628,8 @@ CreateWidget(
textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
+ textPtr->selTagPtr->reliefObj = Tcl_NewStringObj(DEF_TEXT_SELECT_RELIEF, -1);
+ Tcl_IncrRefCount(textPtr->selTagPtr->reliefObj);
textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex);
textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex);
@@ -2269,13 +2271,13 @@ ConfigureText(
if ((textPtr->selTagPtr->elide >= 0)
|| (textPtr->selTagPtr->tkfont != NULL)
|| (textPtr->selTagPtr->justify != TK_JUSTIFY_NULL)
- || (textPtr->selTagPtr->lMargin1String != NULL)
- || (textPtr->selTagPtr->lMargin2String != NULL)
- || (textPtr->selTagPtr->offsetString != NULL)
- || (textPtr->selTagPtr->rMarginString != NULL)
- || (textPtr->selTagPtr->spacing1String != NULL)
- || (textPtr->selTagPtr->spacing2String != NULL)
- || (textPtr->selTagPtr->spacing3String != NULL)
+ || (textPtr->selTagPtr->lMargin1 != INT_MIN)
+ || (textPtr->selTagPtr->lMargin2 != INT_MIN)
+ || (textPtr->selTagPtr->offset != INT_MIN)
+ || (textPtr->selTagPtr->rMargin != INT_MIN)
+ || (textPtr->selTagPtr->spacing1 != INT_MIN)
+ || (textPtr->selTagPtr->spacing2 != INT_MIN)
+ || (textPtr->selTagPtr->spacing3 != INT_MIN)
|| (textPtr->selTagPtr->tabStringPtr != NULL)
|| (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR)
|| (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR)
diff --git a/generic/tkText.h b/generic/tkText.h
index d8154a1..3095086 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -322,9 +322,7 @@ typedef struct TkTextTag {
* value specified here. */
int borderWidth; /* Width of 3-D border for background. */
Tcl_Obj *borderWidthPtr; /* Width of 3-D border for background. */
-#if TCL_MAJOR_VERSION < 9
- char *reliefString; /* Not used any more */
-#endif
+ Tcl_Obj *reliefObj;
int relief; /* 3-D relief for background. */
Pixmap bgStipple; /* Stipple bitmap for background. None means
* no value specified here. */
@@ -335,61 +333,52 @@ typedef struct TkTextTag {
Pixmap fgStipple; /* Stipple bitmap for text and other
* foreground stuff. None means no value
* specified here.*/
-#if TCL_MAJOR_VERSION < 9
- char *justifyString; /* Not used any more */
-#endif
+ Tcl_Obj *justifyObj;
Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT,
* TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER, or TK_JUSTIFY_NULL. */
- char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL
+ Tcl_Obj *lMargin1Obj; /* -lmargin1 option object. NULL
* means option not specified. */
int lMargin1; /* Left margin for first display line of each
- * text line, in pixels. Only valid if
- * lMargin1String is non-NULL. */
- char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL
+ * text line, in pixels. INT_MIN means option not specified. */
+ Tcl_Obj *lMargin2Obj; /* -lmargin2 option object. NULL
* means option not specified. */
- int lMargin2; /* Left margin for second and later display
- * lines of each text line, in pixels. Only
- * valid if lMargin2String is non-NULL. */
+ int lMargin2; /* Left margin for second and later display lines
+ * of each text line, in pixels. */
Tk_3DBorder lMarginColor; /* Used for drawing background in left margins.
* This is used for both lmargin1 and lmargin2.
* NULL means no value specified here. */
- char *offsetString; /* -offset option string (malloc-ed). NULL
+ Tcl_Obj *offsetObj; /* -offset option object. NULL
* means option not specified. */
int offset; /* Vertical offset of text's baseline from
* baseline of line. Used for superscripts and
- * subscripts. Only valid if offsetString is
- * non-NULL. */
+ * subscripts. INT_MIN means option not specified. */
Tcl_Obj *overstrikePtr; /* -overstrike option. NULL
* means option not specified. */
int overstrike; /* > 0 means draw horizontal line through
* middle of text. -1 means not specified. */
XColor *overstrikeColor; /* Color for the overstrike. NULL means same
* color as foreground. */
- char *rMarginString; /* -rmargin option string (malloc-ed). NULL
+ Tcl_Obj *rMarginObj; /* -rmargin option object. NULL
* means option not specified. */
- int rMargin; /* Right margin for text, in pixels. Only
- * valid if rMarginString is non-NULL. */
+ int rMargin; /* Right margin for text, in pixels. INT_MIN means option not specified. */
Tk_3DBorder rMarginColor; /* Used for drawing background in right margin.
* NULL means no value specified here. */
Tk_3DBorder selBorder; /* Used for drawing background for selected text.
* NULL means no value specified here. */
XColor *selFgColor; /* Foreground color for selected text. NULL means
* no value specified here. */
- char *spacing1String; /* -spacing1 option string (malloc-ed). NULL
+ Tcl_Obj *spacing1Obj; /* -spacing1 option object. NULL
* means option not specified. */
int spacing1; /* Extra spacing above first display line for
- * text line. Only valid if spacing1String is
- * non-NULL. */
- char *spacing2String; /* -spacing2 option string (malloc-ed). NULL
+ * text line. INT_MIN means option not specified. */
+ Tcl_Obj *spacing2Obj; /* -spacing2 option object. NULL
* means option not specified. */
int spacing2; /* Extra spacing between display lines for the
- * same text line. Only valid if
- * spacing2String is non-NULL. */
- char *spacing3String; /* -spacing2 option string (malloc-ed). NULL
+ * same text line. INT_MIN means option not specified. */
+ Tcl_Obj *spacing3Obj; /* -spacing3 option object. NULL
* means option not specified. */
int spacing3; /* Extra spacing below last display line for
- * text line. Only valid if spacing3String is
- * non-NULL. */
+ * text line. INT_MIN means option not specified. */
Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not
* specified. */
struct TkTextTabArray *tabArrayPtr;
@@ -408,7 +397,7 @@ typedef struct TkTextTag {
* TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or
* TEXT_WRAPMODE_NULL to use wrapmode for
* whole widget. */
- Tcl_Obj *elidePtr; /* -elide option. NULL
+ Tcl_Obj *elideObj; /* -elide option. NULL
* means option not specified. */
int elide; /* > 0 means that data under this tag
* should not be displayed. -1 means not specified. */
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 8436a82..abe32c4 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -903,12 +903,12 @@ GetStyle(
styleValues.justify = tagPtr->justify;
justifyPrio = tagPtr->priority;
}
- if ((tagPtr->lMargin1String != NULL)
+ if ((tagPtr->lMargin1 != INT_MIN)
&& (tagPtr->priority > lMargin1Prio)) {
styleValues.lMargin1 = tagPtr->lMargin1;
lMargin1Prio = tagPtr->priority;
}
- if ((tagPtr->lMargin2String != NULL)
+ if ((tagPtr->lMargin2 != INT_MIN)
&& (tagPtr->priority > lMargin2Prio)) {
styleValues.lMargin2 = tagPtr->lMargin2;
lMargin2Prio = tagPtr->priority;
@@ -918,7 +918,7 @@ GetStyle(
styleValues.lMarginColor = tagPtr->lMarginColor;
lMarginColorPrio = tagPtr->priority;
}
- if ((tagPtr->offsetString != NULL)
+ if ((tagPtr->offset != INT_MIN)
&& (tagPtr->priority > offsetPrio)) {
styleValues.offset = tagPtr->offset;
offsetPrio = tagPtr->priority;
@@ -933,7 +933,7 @@ GetStyle(
styleValues.overstrikeColor = fgColor;
}
}
- if ((tagPtr->rMarginString != NULL)
+ if ((tagPtr->rMargin != INT_MIN)
&& (tagPtr->priority > rMarginPrio)) {
styleValues.rMargin = tagPtr->rMargin;
rMarginPrio = tagPtr->priority;
@@ -943,17 +943,17 @@ GetStyle(
styleValues.rMarginColor = tagPtr->rMarginColor;
rMarginColorPrio = tagPtr->priority;
}
- if ((tagPtr->spacing1String != NULL)
+ if ((tagPtr->spacing1 != INT_MIN)
&& (tagPtr->priority > spacing1Prio)) {
styleValues.spacing1 = tagPtr->spacing1;
spacing1Prio = tagPtr->priority;
}
- if ((tagPtr->spacing2String != NULL)
+ if ((tagPtr->spacing2 != INT_MIN)
&& (tagPtr->priority > spacing2Prio)) {
styleValues.spacing2 = tagPtr->spacing2;
spacing2Prio = tagPtr->priority;
}
- if ((tagPtr->spacing3String != NULL)
+ if ((tagPtr->spacing3 != INT_MIN)
&& (tagPtr->priority > spacing3Prio)) {
styleValues.spacing3 = tagPtr->spacing3;
spacing3Prio = tagPtr->priority;
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index aaa0159..344fd70 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -25,7 +25,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-elide", NULL, NULL,
- NULL, offsetof(TkTextTag, elidePtr), offsetof(TkTextTag, elide),
+ NULL, offsetof(TkTextTag, elideObj), offsetof(TkTextTag, elide),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BITMAP, "-fgstipple", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
@@ -34,15 +34,15 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
{TK_OPTION_COLOR, "-foreground", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0},
- {TK_OPTION_STRING, "-lmargin1", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-lmargin2", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0},
+ NULL, offsetof(TkTextTag, justifyObj), offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0},
+ {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL,
+ NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL,
+ NULL, offsetof(TkTextTag, lMargin2Obj), offsetof(TkTextTag, lMargin2), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_BORDER, "-lmargincolor", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-offset", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-offset", NULL, NULL,
+ NULL, offsetof(TkTextTag, offsetObj), offsetof(TkTextTag, offset), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL,
NULL, offsetof(TkTextTag, overstrikePtr), offsetof(TkTextTag, overstrike),
TK_OPTION_NULL_OK, 0, 0},
@@ -50,21 +50,21 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-rmargin", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
+ NULL, offsetof(TkTextTag, reliefObj), offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-rmargin", NULL, NULL,
+ NULL, offsetof(TkTextTag, rMarginObj), offsetof(TkTextTag, rMargin), TK_OPTION_NULL_OK, 0,0},
{TK_OPTION_BORDER, "-rmargincolor", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-selectforeground", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-spacing1", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-spacing2", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-spacing3", NULL, NULL,
- NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_PIXELS, "-spacing1", NULL, NULL,
+ NULL, offsetof(TkTextTag, spacing1Obj), offsetof(TkTextTag, spacing1), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_PIXELS, "-spacing2", NULL, NULL,
+ NULL, offsetof(TkTextTag, spacing2Obj), offsetof(TkTextTag, spacing2), TK_OPTION_NULL_OK,0,0},
+ {TK_OPTION_PIXELS, "-spacing3", NULL, NULL,
+ NULL, offsetof(TkTextTag, spacing3Obj), offsetof(TkTextTag, spacing3), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-tabs", NULL, NULL,
NULL, offsetof(TkTextTag, tabStringPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL,
@@ -368,53 +368,17 @@ TkTextTagCmd(
if (tagPtr->borderWidth < 0) {
tagPtr->borderWidth = 0;
}
- if (tagPtr->lMargin1String != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->lMargin1String, &tagPtr->lMargin1) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (tagPtr->lMargin2String != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->lMargin2String, &tagPtr->lMargin2) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (tagPtr->offsetString != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->offsetString,
- &tagPtr->offset) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (tagPtr->rMarginString != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->rMarginString, &tagPtr->rMargin) != TCL_OK) {
- return TCL_ERROR;
- }
- }
- if (tagPtr->spacing1String != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->spacing1String, &tagPtr->spacing1) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (tagPtr->spacing1 != INT_MIN) {
if (tagPtr->spacing1 < 0) {
tagPtr->spacing1 = 0;
}
}
- if (tagPtr->spacing2String != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->spacing2String, &tagPtr->spacing2) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (tagPtr->spacing2 != INT_MIN) {
if (tagPtr->spacing2 < 0) {
tagPtr->spacing2 = 0;
}
}
- if (tagPtr->spacing3String != NULL) {
- if (Tk_GetPixels(interp, textPtr->tkwin,
- tagPtr->spacing3String, &tagPtr->spacing3) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (tagPtr->spacing3 != INT_MIN) {
if (tagPtr->spacing3 < 0) {
tagPtr->spacing3 = 0;
}
@@ -468,13 +432,13 @@ TkTextTagCmd(
if ((tagPtr->elide >= 0)
|| (tagPtr->tkfont != NULL)
|| (tagPtr->justify != TK_JUSTIFY_NULL)
- || (tagPtr->lMargin1String != NULL)
- || (tagPtr->lMargin2String != NULL)
- || (tagPtr->offsetString != NULL)
- || (tagPtr->rMarginString != NULL)
- || (tagPtr->spacing1String != NULL)
- || (tagPtr->spacing2String != NULL)
- || (tagPtr->spacing3String != NULL)
+ || (tagPtr->lMargin1 != INT_MIN)
+ || (tagPtr->lMargin2 != INT_MIN)
+ || (tagPtr->offset != INT_MIN)
+ || (tagPtr->rMargin != INT_MIN)
+ || (tagPtr->spacing1 != INT_MIN)
+ || (tagPtr->spacing2 != INT_MIN)
+ || (tagPtr->spacing3 != INT_MIN)
|| (tagPtr->tabStringPtr != NULL)
|| (tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR)
|| (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR)
@@ -981,46 +945,42 @@ TkTextCreateTag(
tagPtr->border = NULL;
tagPtr->borderWidth = 0;
tagPtr->borderWidthPtr = NULL;
-#if TCL_MAJOR_VERSION < 9
- tagPtr->reliefString = NULL;
-#endif
+ tagPtr->reliefObj = NULL;
tagPtr->relief = TK_RELIEF_NULL;
tagPtr->bgStipple = None;
tagPtr->fgColor = NULL;
tagPtr->tkfont = NULL;
tagPtr->fgStipple = None;
-#if TCL_MAJOR_VERSION < 9
- tagPtr->justifyString = NULL;
-#endif
+ tagPtr->justifyObj = NULL;
tagPtr->justify = TK_JUSTIFY_NULL;
- tagPtr->lMargin1String = NULL;
- tagPtr->lMargin1 = 0;
- tagPtr->lMargin2String = NULL;
- tagPtr->lMargin2 = 0;
+ tagPtr->lMargin1Obj = NULL;
+ tagPtr->lMargin1 = INT_MIN;
+ tagPtr->lMargin2Obj = NULL;
+ tagPtr->lMargin2 = INT_MIN;
tagPtr->lMarginColor = NULL;
- tagPtr->offsetString = NULL;
- tagPtr->offset = 0;
+ tagPtr->offsetObj = NULL;
+ tagPtr->offset = INT_MIN;
tagPtr->overstrikePtr = NULL;
tagPtr->overstrike = -1;
tagPtr->overstrikeColor = NULL;
- tagPtr->rMarginString = NULL;
- tagPtr->rMargin = 0;
+ tagPtr->rMarginObj = NULL;
+ tagPtr->rMargin = INT_MIN;
tagPtr->rMarginColor = NULL;
tagPtr->selBorder = NULL;
tagPtr->selFgColor = NULL;
- tagPtr->spacing1String = NULL;
- tagPtr->spacing1 = 0;
- tagPtr->spacing2String = NULL;
- tagPtr->spacing2 = 0;
- tagPtr->spacing3String = NULL;
- tagPtr->spacing3 = 0;
+ tagPtr->spacing1Obj = NULL;
+ tagPtr->spacing1 = INT_MIN;
+ tagPtr->spacing2Obj = NULL;
+ tagPtr->spacing2 = INT_MIN;
+ tagPtr->spacing3Obj = NULL;
+ tagPtr->spacing3 = INT_MIN;
tagPtr->tabStringPtr = NULL;
tagPtr->tabArrayPtr = NULL;
tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL;
tagPtr->underlinePtr = NULL;
tagPtr->underline = -1;
tagPtr->underlineColor = NULL;
- tagPtr->elidePtr = NULL;
+ tagPtr->elideObj = NULL;
tagPtr->elide = -1;
tagPtr->wrapMode = TEXT_WRAPMODE_NULL;
tagPtr->affectsDisplay = 0;
diff --git a/tests/textTag.test b/tests/textTag.test
index b204364..68f91d9 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -113,11 +113,13 @@ test textTag-1.12 {tag configuration options} -body {
} -cleanup {
.t tag configure x -justify [lindex [.t tag configure x -justify] 3]
} -result {left}
-test textTag-1.13 {configuration options} -constraints needsTcl87 -body {
- .t tag configure x -justify middle
+test textTag-1.13 {configuration options, bug [026e2bb685]} -constraints needsTcl87 -body {
+ .t tag configure x -justify right
+ catch {.t tag configure x -justify middle} msg
+ list $msg [.t tag configure x -justify]
} -cleanup {
.t tag configure x -justify [lindex [.t tag configure x -justify] 3]
-} -returnCodes error -result {bad justification "middle": must be left, right, center, or ""}
+} -result {{bad justification "middle": must be left, right, center, or ""} {-justify {} {} {} right}}
test textTag-1.14 {tag configuration options} -body {
.t tag configure x -lmargin1 10
.t tag cget x -lmargin1
@@ -538,12 +540,13 @@ test textTag-5.8 {TkTextTagCmd - "configure" option} -body {
} -cleanup {
.t tag delete x
} -result {-justify {} {} {} left}
-test textTag-5.9 {TkTextTagCmd - "configure" option} -constraints needsTcl87 -body {
+test textTag-5.9 {TkTextTagCmd - "configure" option, bug [026e2bb685]} -constraints needsTcl87 -body {
.t tag delete x
- .t tag configure x -justify bogus
+ catch {.t tag configure x -justify bogus} msg
+ list $msg [.t tag configure x -justify]
} -cleanup {
.t tag delete x
-} -returnCodes error -result {bad justification "bogus": must be left, right, center, or ""}
+} -result {{bad justification "bogus": must be left, right, center, or ""} {-justify {} {} {} {}}}
test textTag-5.10 {TkTextTagCmd - "configure" option} -constraints needsTcl87 -body {
.t tag delete x
.t tag configure x -justify fill
@@ -1203,6 +1206,7 @@ test textTag-14.4 {SortTags} -setup {
} -cleanup {
.t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}
+
set c [.t bbox 2.1]
set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}]