@@ -2062,9 +2062,9 @@ ConfigureText(
20622062{
20632063 Tk_SavedOptions savedOptions ;
20642064 int oldExport = (textPtr -> exportSelection ) && (!Tcl_IsSafe (textPtr -> interp ));
2065- int mask = 0 ;
2066- int selBorderWidth = INT_MIN , spacing1 , spacing2 , spacing3 ;
2067- int insertBorderWidth , insertWidth ;
2065+ int mask = 0 , selBorderWidth = 0 , height , highlightWidth ;
2066+ int borderWidth , spacing1 , spacing2 , spacing3 ;
2067+ int insertBorderWidth , insertWidth , padX , padY ;
20682068
20692069 if (Tk_SetOptions (interp , (char * ) textPtr , textPtr -> optionTable ,
20702070 objc , objv , textPtr -> tkwin , & savedOptions , & mask ) != TCL_OK ) {
@@ -2204,26 +2204,26 @@ ConfigureText(
22042204 * Don't allow negative spacings.
22052205 */
22062206
2207- Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing1Obj , & spacing1 );
2208- if (spacing1 < 0 ) {
2209- spacing1 = 0 ;
2210- Tcl_DecrRefCount (textPtr -> spacing1Obj );
2211- textPtr -> spacing1Obj = Tcl_NewIntObj (0 );
2212- Tcl_IncrRefCount (textPtr -> spacing1Obj );
2207+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> borderWidthObj , & borderWidth );
2208+ if (borderWidth < 0 ) {
2209+ borderWidth = 0 ;
2210+ Tcl_DecrRefCount (textPtr -> borderWidthObj );
2211+ textPtr -> borderWidthObj = Tcl_NewIntObj (0 );
2212+ Tcl_IncrRefCount (textPtr -> borderWidthObj );
22132213 }
2214- Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing2Obj , & spacing2 );
2215- if (spacing2 < 0 ) {
2216- spacing2 = 0 ;
2217- Tcl_DecrRefCount (textPtr -> spacing2Obj );
2218- textPtr -> spacing2Obj = Tcl_NewIntObj (0 );
2219- Tcl_IncrRefCount (textPtr -> spacing2Obj );
2214+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> heightObj , & height );
2215+ if (height < 0 ) {
2216+ height = 0 ;
2217+ Tcl_DecrRefCount (textPtr -> heightObj );
2218+ textPtr -> heightObj = Tcl_NewIntObj (0 );
2219+ Tcl_IncrRefCount (textPtr -> heightObj );
22202220 }
2221- Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing3Obj , & spacing3 );
2222- if (spacing3 < 0 ) {
2223- spacing3 = 0 ;
2224- Tcl_DecrRefCount (textPtr -> spacing3Obj );
2225- textPtr -> spacing3Obj = Tcl_NewIntObj (0 );
2226- Tcl_IncrRefCount (textPtr -> spacing3Obj );
2221+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> highlightWidthObj , & highlightWidth );
2222+ if (highlightWidth < 0 ) {
2223+ highlightWidth = 0 ;
2224+ Tcl_DecrRefCount (textPtr -> highlightWidthObj );
2225+ textPtr -> highlightWidthObj = Tcl_NewIntObj (0 );
2226+ Tcl_IncrRefCount (textPtr -> highlightWidthObj );
22272227 }
22282228 Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> insertBorderWidthObj , & insertBorderWidth );
22292229 if (insertBorderWidth < 0 ) {
@@ -2239,6 +2239,18 @@ ConfigureText(
22392239 textPtr -> insertWidthObj = Tcl_NewIntObj (0 );
22402240 Tcl_IncrRefCount (textPtr -> insertWidthObj );
22412241 }
2242+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> padXObj , & padX );
2243+ if (padX < 0 ) {
2244+ Tcl_DecrRefCount (textPtr -> padXObj );
2245+ textPtr -> padXObj = Tcl_NewIntObj (0 );
2246+ Tcl_IncrRefCount (textPtr -> padXObj );
2247+ }
2248+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> padYObj , & padY );
2249+ if (padY < 0 ) {
2250+ Tcl_DecrRefCount (textPtr -> padYObj );
2251+ textPtr -> padYObj = Tcl_NewIntObj (0 );
2252+ Tcl_IncrRefCount (textPtr -> padYObj );
2253+ }
22422254 if (textPtr -> selBorderWidthObj ) {
22432255 Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> selBorderWidthObj , & selBorderWidth );
22442256 }
@@ -2250,7 +2262,27 @@ ConfigureText(
22502262 textPtr -> selBorderWidthObj = Tcl_NewIntObj (0 );
22512263 Tcl_IncrRefCount (textPtr -> selBorderWidthObj );
22522264 }
2253-
2265+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing1Obj , & spacing1 );
2266+ if (spacing1 < 0 ) {
2267+ spacing1 = 0 ;
2268+ Tcl_DecrRefCount (textPtr -> spacing1Obj );
2269+ textPtr -> spacing1Obj = Tcl_NewIntObj (0 );
2270+ Tcl_IncrRefCount (textPtr -> spacing1Obj );
2271+ }
2272+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing2Obj , & spacing2 );
2273+ if (spacing2 < 0 ) {
2274+ spacing2 = 0 ;
2275+ Tcl_DecrRefCount (textPtr -> spacing2Obj );
2276+ textPtr -> spacing2Obj = Tcl_NewIntObj (0 );
2277+ Tcl_IncrRefCount (textPtr -> spacing2Obj );
2278+ }
2279+ Tk_GetPixelsFromObj (NULL , textPtr -> tkwin , textPtr -> spacing3Obj , & spacing3 );
2280+ if (spacing3 < 0 ) {
2281+ spacing3 = 0 ;
2282+ Tcl_DecrRefCount (textPtr -> spacing3Obj );
2283+ textPtr -> spacing3Obj = Tcl_NewIntObj (0 );
2284+ Tcl_IncrRefCount (textPtr -> spacing3Obj );
2285+ }
22542286
22552287 /*
22562288 * Parse tab stops.
0 commit comments