[Tkabber-dev] r1281 - in trunk/tkabber-plugins: . ctcomp

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Oct 26 19:42:53 MSD 2007


Author: sergei
Date: 2007-10-26 19:42:52 +0400 (Fri, 26 Oct 2007)
New Revision: 1281

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/ctcomp/ctcomp.tcl
Log:
	* ctcomp/ctcomp.tcl: Fixed definition of word edges (thanks to
	  Konstantin Khomoutov).


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2007-10-24 15:14:42 UTC (rev 1280)
+++ trunk/tkabber-plugins/ChangeLog	2007-10-26 15:42:52 UTC (rev 1281)
@@ -1,3 +1,8 @@
+2007-10-26  Sergei Golovan <sgolovan at nes.ru>
+
+	* ctcomp/ctcomp.tcl: Fixed definition of word edges (thanks to
+	  Konstantin Khomoutov).
+
 2007-10-23  Sergei Golovan <sgolovan at nes.ru>
 
 	* floatinglog/floatinglog.tcl: Raise floatinlog window. It helps to

Modified: trunk/tkabber-plugins/ctcomp/ctcomp.tcl
===================================================================
--- trunk/tkabber-plugins/ctcomp/ctcomp.tcl	2007-10-24 15:14:42 UTC (rev 1280)
+++ trunk/tkabber-plugins/ctcomp/ctcomp.tcl	2007-10-26 15:42:52 UTC (rev 1281)
@@ -180,8 +180,20 @@
     return true
 }
 
+proc ctcomp::startOfPreviousWord {str start} {
+    if {[string equal $start end]} {
+	set start [string length $str]
+    }
+    if {[regexp -indices {\m(\w+)\W*$} \
+	    [string range $str 0 [expr {$start - 1}]] -> word]} {
+	return [lindex $word 0]
+    }
+    return -1
+}
+
 proc ctcomp::word {"from" t} {
-    set from [tk::TextPrevPos $t insert tcl_startOfPreviousWord]
+    set from [tk::TextPrevPos $t insert \
+	[namespace current]::startOfPreviousWord]
     $t get $from insert
 }
 



More information about the Tkabber-dev mailing list