[Tkabber-dev] r777 - in trunk/tkabber: . plugins/richtext

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Nov 4 00:25:35 MSK 2006


Author: sergei
Date: 2006-11-04 00:25:32 +0300 (Sat, 04 Nov 2006)
New Revision: 777

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/richtext/emoticons.tcl
Log:
	* plugins/richtext/emoticons.tcl: Fixed escaping regexp
	  metacharacters. Also fixed emoticons::add procedure.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-11-03 20:17:28 UTC (rev 776)
+++ trunk/tkabber/ChangeLog	2006-11-03 21:25:32 UTC (rev 777)
@@ -1,3 +1,8 @@
+2006-11-04  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/richtext/emoticons.tcl: Fixed escaping regexp
+	  metacharacters. Also fixed emoticons::add procedure.
+
 2006-11-03  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/richtext/urls.tcl: Fixed URL regular expression.

Modified: trunk/tkabber/plugins/richtext/emoticons.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/emoticons.tcl	2006-11-03 20:17:28 UTC (rev 776)
+++ trunk/tkabber/plugins/richtext/emoticons.tcl	2006-11-03 21:25:32 UTC (rev 777)
@@ -9,7 +9,6 @@
     variable lasttext ""
     variable lastX
     variable lastY
-    variable faces_list {}
     variable faces_regexp ""
 
     variable options
@@ -60,6 +59,10 @@
     variable images
     variable faces_regexp
 
+    if {![info exists images($image)]} {
+	set images($image) 0
+    }
+
     if {[info exists emoticons($face)]} {
 	incr images($emoticons($face)) -1
     }
@@ -68,8 +71,6 @@
 
     incr images($image)
 
-    lappend faces_list [re_escape $face]
-
     if {$faces_regexp != ""} {
 	append faces_regexp |
     }
@@ -466,7 +467,10 @@
 			( \\(
 			) \\)
 			| \\|
-			? \\?} $s]
+			? \\?
+			$ \\$
+			^ \\^
+			+ \\+} $s]
 }
 
 proc emoticons::configure_richtext_widget {w} {
@@ -612,12 +616,11 @@
 proc emoticons::rebuild_faces_regex {} {
     variable options
     variable emoticons
-    variable faces_list
     variable faces_regexp
 
     set faces_regexp ""
 
-    foreach face $faces_list {
+    foreach face [array names emoticons] {
 	if {$faces_regexp != ""} {
 	    append faces_regexp |
 	}



More information about the Tkabber-dev mailing list