Scipad 6.87
Francois Vogel [Wed, 7 Feb 2007 23:20:25 +0000 (23:20 +0000)]
 * Fixed nasty substitution needs in proc scilaberror (Tcl special characters
   need to be escaped in the error string)
 * Fixed overzealous selection of the entire line when this line is shorter
   than the block margin (block selection)
 * Really, this time the cursor should no longer be after the end, nor inside
   the block selection

scilab/modules/scipad/VERSION
scilab/modules/scipad/changelog.txt
scilab/modules/scipad/tcl/modselection.tcl
scilab/modules/scipad/tcl/scilabexec.tcl
scilab/modules/scipad/tcl/tkdndtools.tcl

index e822bbc..0f7d920 100644 (file)
@@ -1,5 +1,5 @@
 SCI_VERSION_MAJOR 6
-SCI_VERSION_MINOR 86
+SCI_VERSION_MINOR 87
 SCI_VERSION_MAINTENANCE 0
 SCI_VERSION_STRING SciPad unstable-svn
 SCI_VERSION_REVISION 0
\ No newline at end of file
index 21b7bcd..fa38a9a 100644 (file)
@@ -2804,3 +2804,12 @@ Francois VOGEL, 04/02/07
    way the selection text is built and returned has been changed to fix
    this issue
  * version --> 6.86
+
+Francois VOGEL, 07/02/07
+ * Fixed nasty substitution needs in proc scilaberror (Tcl special characters
+   need to be escaped in the error string)
+ * Fixed overzealous selection of the entire line when this line is shorter
+   than the block margin (block selection)
+ * Really, this time the cursor should no longer be after the end, nor inside
+   the block selection
+ * version --> 6.87
index 980b22e..9f3a4ac 100644 (file)
@@ -6,7 +6,6 @@ proc TextClosestGap_scipad {w x y} {
 # functions must exist to guard against private functions changes
 # in Tk
     if {[catch {::tk::TextClosestGap $w $x $y} ind] != 0} {
-    puts fallback
         set ind [$w index @$x,$y]
     }
     return $ind
@@ -153,15 +152,28 @@ proc selectblock {w x y} {
 
     # finally, tag the lines!
     $w tag remove sel 1.0 end
-    set dlinfo [$w dlineinfo @0,0]
-    set lineheight [lindex $dlinfo 3]
-    for {set i $anchory} {$i <= [expr {$cornery + $lineheight / 2}]} {incr i $lineheight} {
+    # note: since $anchory and $corney are pixel coordinates, one could
+    #       have thought of using {incr i $lineheigth} instead of {incr i}
+    #       but this would cause incredible headaches to have the cursor
+    #       never after the end of the selection, and never inside it
+    #       so I forgot any optimization here and run the loop pixel
+    #       by pixel, eventually tagging the same portion of text multiple
+    #       times
+    for {set i $anchory} {$i <= $cornery} {incr i} {
         set sta [TextClosestGap_scipad $w $anchorx $i]
         set sto [TextClosestGap_scipad $w $cornerx $i]
         if {[$w compare $sta == $sto]} {
-            # tag the entire line
-            set sta "$sta linestart"
-            set sto "$sto + 1l linestart"
+            set dlinfo [$w dlineinfo $sta]
+            set linex [lindex $dlinfo 0]
+            set linewidth [lindex $dlinfo 2]
+            if {[expr {$linex+$linewidth}] < $anchorx} {
+                # the line is shorter than the block left limit
+                # in this case, tag the \n at the end of this line
+                # note that the test above works even if the textarea
+                # has been scrolled horizontally: $linex is negative
+                # in this case, and this is what is needed
+                set sto "$sto + 1l linestart"
+            }
         }
         $w tag add sel $sta $sto
     }
index 4c4beb1..c2f514b 100644 (file)
@@ -349,8 +349,20 @@ proc scilaberror {funnameargs} {
                    TCL_EvalStr(\"global errnum errline errmsg errfunc; \
                                  set errnum  \"+string(db_n)+\"; \
                                  set errline \"+string(db_l)+\"; \
-                                 set errfunc \"\"\"+strsubst(db_func,\"\"\"\",\"\\\"\"\")+\"\"\"; \
-                                 set errmsg  \"\"\"+strsubst(db_str,\"\"\"\",\"\\\"\"\")+\"\"\" \" , \"scipad\" )" \
+                                 set errfunc \"\"\"+strsubst(
+                                                              db_func,\"\"\"\",\"\\\"\"\")
+                                                   +\"\"\"; \
+                                 set errmsg  \"\"\"+strsubst( \
+                                                    strsubst( \
+                                                    strsubst( \
+                                                    strsubst( \
+                                                    strsubst( \
+                                                               db_str,\"\"\"\",\"\\\"\"\") \
+                                                                     ,\"''\",\"\\''\") \
+                                                                     ,\"$\",\"\\$\") \
+                                                                     ,\"\[\",\"\\\[\") \
+                                                                     ,\"\]\",\"\\\]\") \
+                                                   +\"\"\" \" , \"scipad\" )" \
                   "sync" "seq"
     tk_messageBox -title [mc "Scilab execution error"] \
       -message [concat [mc "The shell reported an error while trying to execute "]\
index 6f03ceb..4c3f473 100644 (file)
@@ -169,6 +169,10 @@ proc tkdndbind {w} {
                                                  break ; \
                                               } \
                                             }
+    # prevent from extending the block selection by dragging outside
+    # of the visible part of the textarea, since this is not compatible
+    # with the pixel-like block selection process
+    bind $w <Shift-Control-Button1-Leave> { break }
 
     # nice cursor change when mouse is over the selection
     $w tag bind sel <Enter> {%W configure -cursor hand2 ; set mouseoversel "true"}