Добавлен поиск переменной в тексте после открытия файла где она указана

This commit is contained in:
Sergey Kalinin 2022-09-18 10:46:59 +03:00
parent c755e79517
commit 02bc6e852d
2 changed files with 12 additions and 4 deletions

View File

@ -165,7 +165,7 @@ proc SearchVariable {txt} {
proc GetVariableFilePath {txt} { proc GetVariableFilePath {txt} {
set str [$txt get {insert linestart} {insert lineend}] set str [$txt get {insert linestart} {insert lineend}]
if [regexp -nocase -all -- {^([0-9A-Za-z\-_:]*?) :: (.*?) :: (.*?)$} $str match vName vValue vPath] { if [regexp -nocase -all -- {^([0-9A-Za-z\-_:]*?) :: (.*?) :: (.*?)$} $str match vName vValue vPath] {
return $vPath return [list $vName $vPath]
} }
} }
proc FindVariablesDialog {txt args} { proc FindVariablesDialog {txt args} {
@ -246,10 +246,14 @@ proc FindVariablesDialog {txt args} {
# puts "- $id - $values - $key" # puts "- $id - $values - $key"
# regsub -all {PROCNAME} $findString $values str # regsub -all {PROCNAME} $findString $values str
# Editor::FindFunction "$str" # Editor::FindFunction "$str"
set path [GetVariableFilePath $win.lBox] set _v [GetVariableFilePath $win.lBox]
set varName [lindex $_v 0]
set path [lindex $_v 1]
unset _v
if {$path ne ""} { if {$path ne ""} {
destroy .findVariables destroy .findVariables
FileOper::Edit $path FileOper::Edit $path
Editor::FindFunction "$varName"
} }
# $txt tag remove sel 1.0 end # $txt tag remove sel 1.0 end
# focus $Editor::txt.t # focus $Editor::txt.t
@ -257,10 +261,14 @@ proc FindVariablesDialog {txt args} {
} }
# bind $win.lBox <Double-ButtonPress-1> {Tree::DoublePressItem $win.lBox} # bind $win.lBox <Double-ButtonPress-1> {Tree::DoublePressItem $win.lBox}
bind $win.lBox <ButtonRelease-1> { bind $win.lBox <ButtonRelease-1> {
set path [GetVariableFilePath $win.lBox] set _v [GetVariableFilePath $win.lBox]
set varName [lindex $_v 0]
set path [lindex $_v 1]
unset _v
if {$path ne ""} { if {$path ne ""} {
destroy .findVariables destroy .findVariables
FileOper::Edit $path FileOper::Edit $path
Editor::FindFunction "$varName"
} }
break break
} }

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha # Release: alpha
# Build: 18092022095233 # Build: 18092022102313
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.