diff --git a/lib/editor.tcl b/lib/editor.tcl index 3c07209..d8482b1 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -796,7 +796,7 @@ namespace eval Editor { wm geom $win +$x+$y } - proc FindReplaceText {txt findString replaceString regexp} { +proc FindReplaceText {txt findString replaceString regexp} { global nbEditor puts [focus] # set txt [$nbEditor select].frmText.t @@ -827,8 +827,8 @@ namespace eval Editor { set lstFindIndex [$txt search -all -nocase -count matchIndexPair $findString $line.$x end] # set symNumbers [string length "$findString"] } - puts $lstFindIndex - puts $matchIndexPair + # puts $lstFindIndex + # puts $matchIndexPair # set lstFindIndex [$txt search -all "$selectionText" 0.0] set i 0 foreach ind $lstFindIndex { @@ -836,7 +836,7 @@ namespace eval Editor { set selFindRow [lindex [split $ind "."] 1] # set endInd "$selFindLine.[expr $selFindRow + $symNumbers]" set endInd "$selFindLine.[expr [lindex $matchIndexPair $i] + $selFindRow]" - puts "$ind; $selFindLine, $selFindRow; $endInd " + # puts "$ind; $selFindLine, $selFindRow; $endInd " if {$replaceString ne ""} { $txt replace $ind $endInd $replaceString } @@ -852,7 +852,7 @@ namespace eval Editor { if {[lindex $lstFindIndex 0] ne "" } { # $txt see [lindex $lstFindIndex 0] $txt mark set insert [lindex $lstFindIndex 0] - $text see insert + $txt see insert } # puts $pos # # highlight the found word @@ -874,18 +874,25 @@ namespace eval Editor { variable txt variable win variable show - - set findString "" set replaceString "" - + + if {$w ne ""} { + set txt $w + } else { + if {[$nbEditor select] ne ""} { + set txt [$nbEditor select].frmText.t + puts $txt + } else { + return + } + } # set txt $w.frmText.t - set txt $w set win .finddialog set regexpSet "" set searchAll "-all" - if { [winfo exists $win] } { destroy $win } + if { [winfo exists $win] } { des`troy $win } toplevel $win wm transient $win . wm overrideredirect $win 1 @@ -934,8 +941,8 @@ namespace eval Editor { grid $win.lblCounter -row 2 -column 2 -sticky we # set reqWidth [winfo reqwidth $win] - set boxX [expr [winfo rootx $w] + [expr [winfo width $nbEditor] - 350]] - set boxY [expr [winfo rooty $w] + 10] + set boxX [expr [winfo rootx $txt] + [expr [winfo width $nbEditor] - 350]] + set boxY [expr [winfo rooty $txt] + 10] bind $win { destroy $Editor::win diff --git a/lib/files.tcl b/lib/files.tcl index 99aebe3..338abda 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -296,9 +296,8 @@ namespace eval FileOper { set str "" set nbEditorItem [$nbEditor select] if {$nbEditorItem ne ""} { - # set txt $nbEditorItem.frmText.t - set txt [focus] - + set txt $nbEditorItem.frmText.t + # set txt [focus] set selIndex [$txt tag ranges sel] if {$selIndex ne ""} { set selBegin [lindex [$txt tag ranges sel] 0] diff --git a/lib/menu.tcl b/lib/menu.tcl index 6cd8a1f..9e7504c 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -52,10 +52,10 @@ proc GetEditMenu {m} { $m add command -label [::msgcat::mc "Cut"] -command Cut\ -accelerator "Ctrl+Z" $m add separator - $m add command -label [::msgcat::mc "Find"] -command Find\ + $m add command -label [::msgcat::mc "Find"] -command {Editor::FindDialog ""}\ -accelerator "Ctrl+F" - $m add command -label [::msgcat::mc "Replace"] -command Replace\ - -accelerator "Ctrl+R" + # $m add command -label [::msgcat::mc "Replace"] -command Replace\ + # -accelerator "Ctrl+R" $m add separator $m add command -label [::msgcat::mc "Find in files"] -command "FileOper::FindInFiles"\ -accelerator "Ctrl+Shift+F" diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 97dba8f..8d7daff 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -373,6 +373,7 @@ proc FindInFilesDialog {txt {args ""}} { # puts $txt # set txt $w.frmText.t if {$txt ne ""} { + focus $txt set box [$txt bbox insert] set x [expr [lindex $box 0] + [winfo rootx $txt] ] set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]