diff --git a/lib/editor.tcl b/lib/editor.tcl index c0b4182..cd16c9d 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -20,7 +20,7 @@ namespace eval Editor { set lineEnd [lindex [split [lindex $selIndex 1] "."] 0] set posBegin [lindex [split [lindex $selIndex 1] "."] 0] set posEnd [lindex [split [lindex $selIndex 1] "."] 1] - if {$lineEnd == $lineNum || $posEnd == 0} { + if {$lineEnd == $lineNum && $posEnd == 0} { set lineEnd [expr $lineEnd - 1] } for {set i $lineBegin} {$i <=$lineEnd} {incr i} { @@ -401,6 +401,7 @@ namespace eval Editor { set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"] puts "$nbEditorItem, $nbEditor" Editor $fileFullPath $nbEditor $nbEditorItem + SetModifiedFlag $nbEditorItem } proc Editor {fileFullPath nb itemName} { global cfgVariables @@ -442,3 +443,40 @@ namespace eval Editor { return $fr } } + +# ctextBindings.tcl +# +# Copyright (C) 2012 Sedat Serper +# A similar script and functionality is implemented in tGĀ² as of v1.06.01.41 +# +# proc ctext_binding4Tag {w tags} { + # # foreach tag $tags { + # $w tag bind $tag {%W config -cursor hand2} + # $w tag bind $tag {%W config -cursor xterm} + # $w tag bind $tag { + # set cur [::tk::TextClosestGap %W %x %y] + # if {[catch {%W index anchor}]} {%W mark set anchor $cur} + # set anchor [%W index anchor] + # set last [::tk::TextNextPos %W "$cur - 1c" tcl_wordBreakAfter] + # set first [::tk::TextPrevPos %W anchor tcl_wordBreakBefore] + # if {![catch {set tmp [%W get $first $last]}]} { + # ctext_execTagCmd $tmp + # } + # } + # } +# } +# +# +# THE DEMO +# +# # ----------------------- demo ------------------------------------------- +# # Open a new wish console and copy/paste the following complete script. +# # Clicking on parts that are highlighted and observe the console output... +# # Adjust procedure 'ctext_execTagCmd' to customize the handling 4 your application. +# package require ctext +# pack [ctext .t] -fill both -expand 1 +# ctext::addHighlightClass .t bindings purple [list ] +# ctext::addHighlightClass .t commands orange [list foreach proc if set catch] +# .t fastinsert end [info body ctext_binding4Tag] +# .t highlight 1.0 end +# ctext_binding4Tag .t {bindings commands} diff --git a/lib/files.tcl b/lib/files.tcl index e232ee2..04efacc 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -93,8 +93,10 @@ namespace eval FileOper { return } set fileName [string range $filePath [expr [string last "/" $filePath]+1] end] - puts "$filePath, $fileName" - set treeitem [Tree::InsertItem $tree {} $filePath "file" $fileName] + puts ">>>>>$filePath, $fileName" + # set treeitem [Tree::InsertItem $tree {} $filePath "file" $fileName] + # Close + # Edit $filePath } else { set treeItem "file::[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end ]" set filePath [Tree::GetItemID $tree $treeItem]