Tk Library Source Code

Artifact [717518894f]
Login

Artifact 717518894f4eb0ef67112a4b941b849db042c715:

Attachment "abomination-bug.patch" to ticket [891024ffff] added by patthoyts 2004-02-05 21:20:13.
? abomination-bug.patch
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcllib/tclapps/apps/tkchat/ChangeLog,v
retrieving revision 1.101
diff -u -r1.101 ChangeLog
--- ChangeLog	4 Feb 2004 00:25:55 -0000	1.101
+++ ChangeLog	5 Feb 2004 14:16:20 -0000
@@ -1,3 +1,8 @@
+2004-02-05  Pat Thoyts  <[email protected]>
+
+	* tkchat.tcl: Some fixes and catches in the color handling to deal 
+	with tcllib bug #891024.
+
 2004-02-03  Jeff Hobbs  <[email protected]>
 
 	* tkchat.tcl (::tkchat::Init): change default LogLevel to 'notice'
Index: tkchat.tcl
===================================================================
RCS file: /cvsroot/tcllib/tclapps/apps/tkchat/tkchat.tcl,v
retrieving revision 1.134
diff -u -r1.134 tkchat.tcl
--- tkchat.tcl	4 Feb 2004 00:25:55 -0000	1.134
+++ tkchat.tcl	5 Feb 2004 14:16:23 -0000
@@ -1228,9 +1228,9 @@
         .txt config -tabs [list $wid l]
         .txt tag configure MSG -lmargin2 $wid
     }
-    if {"$clr" == ""} {
+    if {$clr == ""} {
         set clr [getColor $nick]
-        if {"$clr" == ""} {
+        if {$clr == ""} {
             set clr [getColor MainFG]
         }
     }
@@ -1242,11 +1242,19 @@
         set Options(Color,$nick,Which) Web
         ::tkchat::NickVisMenu
     }
-    if {[string compare $Options(Color,$nick,Web) $clr]} {
+    if {![info exists Options(Color,$nick,Web)] ||
+        [string compare $Options(Color,$nick,Web) $clr]} {
         # new color
         set Options(Color,$nick,Web) $clr
         set Options(Color,$nick,Inv) [::tkchat::invClr $clr]
-        .txt tag configure NICK-$nick -foreground "#[getColor $nick]"
+        if {![info exists Options(Color,$nick,Mine)]} {
+            set Options(Color,$nick,Mine) [getColor MainFG]
+        }
+        set clr [getColor $nick]
+        if {$clr == ""} { set clr [getColor MainFG] }
+        if {[catch {
+            .txt tag configure NICK-$nick -foreground "#$clr"
+        } msg]} { log::log debug "checkNick: \"$msg\"" }
     }
 }
 
@@ -3254,7 +3262,13 @@
     .names config -bg "#[getColor MainBG]" -fg "#[getColor MainFG]"
     .txt tag configure found -background "#[getColor SearchBG]"
     foreach nk $Options(NickList) {
-        .txt tag config NICK-$nk -foreground "#[getColor $nk]"
+        set clr [getColor $nk]
+        if {$clr == ""} {
+            set clr [getColor MainFG]
+        }
+        if {[catch {
+            .txt tag config NICK-$nk -foreground "#$clr"
+        } msg]} { log::log debug "applyColors: \"$msg\"" }
     }
 }