[Tkabber-dev] r536 - in trunk/plugins/notes: . ifaces

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jul 21 19:08:01 MSK 2013


Author: Totktonada
Date: 2013-07-21 19:08:01 +0400 (Sun, 21 Jul 2013)
New Revision: 536

Modified:
   trunk/plugins/notes/gui_actions.tcl
   trunk/plugins/notes/ifaces/gui.tcl
   trunk/plugins/notes/notes.tcl
Log:
Notes plugin:

* Fix typo in TODO comment.
* Optimize 'expr' usage and few indent fixes.
* Fix string comparison by 'expr'.


Modified: trunk/plugins/notes/gui_actions.tcl
===================================================================
--- trunk/plugins/notes/gui_actions.tcl	2013-07-21 14:59:50 UTC (rev 535)
+++ trunk/plugins/notes/gui_actions.tcl	2013-07-21 15:08:01 UTC (rev 536)
@@ -12,8 +12,9 @@
 }
 
 proc gui_actions::selection_popup {m W X Y x y} {
-    if {[expr [lempty [$W tag ranges sel]] || \
-        [expr [llength [plugins::notes::connections]] == 0]]} {
+    if {[lempty [$W tag ranges sel]] || \
+        [llength [plugins::notes::connections]] == 0} \
+    {
         set state disabled
     } else {
         set state normal
@@ -25,13 +26,13 @@
 }
 
 proc gui_actions::CopySelection {cw} {
-    if {$cw == "."} {
+    if {$cw eq "."} {
         set cw [get_chatwin]
-        if {$cw == ""} return
+        if {$cw eq ""} return
     }
 
     set sel [$cw tag ranges sel]
-    if {$sel == ""} return
+    if {$sel eq ""} return
 
     set text [$cw get [lindex $sel 0] [lindex $sel 1]]
 

Modified: trunk/plugins/notes/ifaces/gui.tcl
===================================================================
--- trunk/plugins/notes/ifaces/gui.tcl	2013-07-21 14:59:50 UTC (rev 535)
+++ trunk/plugins/notes/ifaces/gui.tcl	2013-07-21 15:08:01 UTC (rev 536)
@@ -4,7 +4,7 @@
 #    package require msgcat
 }
 
-# TODO: variable lbox in all proc, where $lbox used, changed this variable in create_nptes_tab. Also: conn_menu.
+# TODO: variable lbox in all proc, where $lbox used, changed this variable in create_notes_tab. Also: conn_menu.
 
 proc ifaces::gui::load {} {
     hook::add plugins_notes_changed_connections_hook \
@@ -299,8 +299,9 @@
         $lbox delete $idx $idx
     }
 
-    if {[expr [llength $new_note] != 0] &&
-        [::plugins::notes::filter $new_note [get_filter_tags]]} {
+    if {[llength $new_note] != 0 &&
+        [::plugins::notes::filter $new_note [get_filter_tags]]} \
+    {
         $lbox insert $idx [get_short_string $new_note]
     }
 
@@ -392,7 +393,7 @@
 if {0} {
     set max_length 30
     if {[string length $short_string] > $max_length} {
-        set short_string "[string range $short_string 0 [expr $max_length - 4]]..."
+        set short_string "[string range $short_string 0 [expr {$max_length - 4}]]..."
     }
 }
 

Modified: trunk/plugins/notes/notes.tcl
===================================================================
--- trunk/plugins/notes/notes.tcl	2013-07-21 14:59:50 UTC (rev 535)
+++ trunk/plugins/notes/notes.tcl	2013-07-21 15:08:01 UTC (rev 536)
@@ -85,7 +85,7 @@
     variable notes
     variable current_xlib
 
-    if {$status != "ok"} return
+    if {$status ne "ok"} return
 
  #TODO( maybe not sending event?
     free_notes $xlib
@@ -135,6 +135,7 @@
     variable notes
     variable current_xlib
 
+    # TODO: can 'xlib' contain special glob symbols or ","?
     array unset notes $xlib
     hook::run plugins_notes_changed_connections_hook
 # TODO: possibly, comfortable variant:



More information about the Tkabber-dev mailing list