Bug fix
This commit is contained in:
parent
32013d87a7
commit
123d38b6ae
|
@ -796,7 +796,7 @@ namespace eval Editor {
|
||||||
wm geom $win +$x+$y
|
wm geom $win +$x+$y
|
||||||
}
|
}
|
||||||
|
|
||||||
proc FindReplaceText {txt findString replaceString regexp} {
|
proc FindReplaceText {txt findString replaceString regexp} {
|
||||||
global nbEditor
|
global nbEditor
|
||||||
puts [focus]
|
puts [focus]
|
||||||
# set txt [$nbEditor select].frmText.t
|
# 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 lstFindIndex [$txt search -all -nocase -count matchIndexPair $findString $line.$x end]
|
||||||
# set symNumbers [string length "$findString"]
|
# set symNumbers [string length "$findString"]
|
||||||
}
|
}
|
||||||
puts $lstFindIndex
|
# puts $lstFindIndex
|
||||||
puts $matchIndexPair
|
# puts $matchIndexPair
|
||||||
# set lstFindIndex [$txt search -all "$selectionText" 0.0]
|
# set lstFindIndex [$txt search -all "$selectionText" 0.0]
|
||||||
set i 0
|
set i 0
|
||||||
foreach ind $lstFindIndex {
|
foreach ind $lstFindIndex {
|
||||||
|
@ -836,7 +836,7 @@ namespace eval Editor {
|
||||||
set selFindRow [lindex [split $ind "."] 1]
|
set selFindRow [lindex [split $ind "."] 1]
|
||||||
# set endInd "$selFindLine.[expr $selFindRow + $symNumbers]"
|
# set endInd "$selFindLine.[expr $selFindRow + $symNumbers]"
|
||||||
set endInd "$selFindLine.[expr [lindex $matchIndexPair $i] + $selFindRow]"
|
set endInd "$selFindLine.[expr [lindex $matchIndexPair $i] + $selFindRow]"
|
||||||
puts "$ind; $selFindLine, $selFindRow; $endInd "
|
# puts "$ind; $selFindLine, $selFindRow; $endInd "
|
||||||
if {$replaceString ne ""} {
|
if {$replaceString ne ""} {
|
||||||
$txt replace $ind $endInd $replaceString
|
$txt replace $ind $endInd $replaceString
|
||||||
}
|
}
|
||||||
|
@ -852,7 +852,7 @@ namespace eval Editor {
|
||||||
if {[lindex $lstFindIndex 0] ne "" } {
|
if {[lindex $lstFindIndex 0] ne "" } {
|
||||||
# $txt see [lindex $lstFindIndex 0]
|
# $txt see [lindex $lstFindIndex 0]
|
||||||
$txt mark set insert [lindex $lstFindIndex 0]
|
$txt mark set insert [lindex $lstFindIndex 0]
|
||||||
$text see insert
|
$txt see insert
|
||||||
}
|
}
|
||||||
# puts $pos
|
# puts $pos
|
||||||
# # highlight the found word
|
# # highlight the found word
|
||||||
|
@ -874,18 +874,25 @@ namespace eval Editor {
|
||||||
variable txt
|
variable txt
|
||||||
variable win
|
variable win
|
||||||
variable show
|
variable show
|
||||||
|
|
||||||
|
|
||||||
set findString ""
|
set findString ""
|
||||||
set replaceString ""
|
set replaceString ""
|
||||||
|
|
||||||
# set txt $w.frmText.t
|
if {$w ne ""} {
|
||||||
set txt $w
|
set txt $w
|
||||||
|
} else {
|
||||||
|
if {[$nbEditor select] ne ""} {
|
||||||
|
set txt [$nbEditor select].frmText.t
|
||||||
|
puts $txt
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# set txt $w.frmText.t
|
||||||
set win .finddialog
|
set win .finddialog
|
||||||
set regexpSet ""
|
set regexpSet ""
|
||||||
set searchAll "-all"
|
set searchAll "-all"
|
||||||
|
|
||||||
if { [winfo exists $win] } { destroy $win }
|
if { [winfo exists $win] } { des`troy $win }
|
||||||
toplevel $win
|
toplevel $win
|
||||||
wm transient $win .
|
wm transient $win .
|
||||||
wm overrideredirect $win 1
|
wm overrideredirect $win 1
|
||||||
|
@ -934,8 +941,8 @@ namespace eval Editor {
|
||||||
grid $win.lblCounter -row 2 -column 2 -sticky we
|
grid $win.lblCounter -row 2 -column 2 -sticky we
|
||||||
|
|
||||||
# set reqWidth [winfo reqwidth $win]
|
# set reqWidth [winfo reqwidth $win]
|
||||||
set boxX [expr [winfo rootx $w] + [expr [winfo width $nbEditor] - 350]]
|
set boxX [expr [winfo rootx $txt] + [expr [winfo width $nbEditor] - 350]]
|
||||||
set boxY [expr [winfo rooty $w] + 10]
|
set boxY [expr [winfo rooty $txt] + 10]
|
||||||
|
|
||||||
bind $win <Escape> {
|
bind $win <Escape> {
|
||||||
destroy $Editor::win
|
destroy $Editor::win
|
||||||
|
|
|
@ -296,9 +296,8 @@ namespace eval FileOper {
|
||||||
set str ""
|
set str ""
|
||||||
set nbEditorItem [$nbEditor select]
|
set nbEditorItem [$nbEditor select]
|
||||||
if {$nbEditorItem ne ""} {
|
if {$nbEditorItem ne ""} {
|
||||||
# set txt $nbEditorItem.frmText.t
|
set txt $nbEditorItem.frmText.t
|
||||||
set txt [focus]
|
# set txt [focus]
|
||||||
|
|
||||||
set selIndex [$txt tag ranges sel]
|
set selIndex [$txt tag ranges sel]
|
||||||
if {$selIndex ne ""} {
|
if {$selIndex ne ""} {
|
||||||
set selBegin [lindex [$txt tag ranges sel] 0]
|
set selBegin [lindex [$txt tag ranges sel] 0]
|
||||||
|
|
|
@ -52,10 +52,10 @@ proc GetEditMenu {m} {
|
||||||
$m add command -label [::msgcat::mc "Cut"] -command Cut\
|
$m add command -label [::msgcat::mc "Cut"] -command Cut\
|
||||||
-accelerator "Ctrl+Z"
|
-accelerator "Ctrl+Z"
|
||||||
$m add separator
|
$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"
|
-accelerator "Ctrl+F"
|
||||||
$m add command -label [::msgcat::mc "Replace"] -command Replace\
|
# $m add command -label [::msgcat::mc "Replace"] -command Replace\
|
||||||
-accelerator "Ctrl+R"
|
# -accelerator "Ctrl+R"
|
||||||
$m add separator
|
$m add separator
|
||||||
$m add command -label [::msgcat::mc "Find in files"] -command "FileOper::FindInFiles"\
|
$m add command -label [::msgcat::mc "Find in files"] -command "FileOper::FindInFiles"\
|
||||||
-accelerator "Ctrl+Shift+F"
|
-accelerator "Ctrl+Shift+F"
|
||||||
|
|
|
@ -373,6 +373,7 @@ proc FindInFilesDialog {txt {args ""}} {
|
||||||
# puts $txt
|
# puts $txt
|
||||||
# set txt $w.frmText.t
|
# set txt $w.frmText.t
|
||||||
if {$txt ne ""} {
|
if {$txt ne ""} {
|
||||||
|
focus $txt
|
||||||
set box [$txt bbox insert]
|
set box [$txt bbox insert]
|
||||||
set x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
set x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
||||||
set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user