Compare commits

...

2 Commits

3 changed files with 26 additions and 8 deletions

8
debian/changelog vendored
View File

@ -1,5 +1,11 @@
projman (2.0.0-alpha2) stable; urgency=medium
* Fixed incorrect replacement of an expression when searching if there are multiple matches in a string
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 17 Jul 2024 12:20:00 +0300
projman (2.0.0-alpha) stable; urgency=medium projman (2.0.0-alpha) stable; urgency=medium
* Initial release * Initial release
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 20 Jul 2022 16:56:31 +0300 -- Sergey Kalinin <svk@nuk-svk.ru> Wed, 27 Nov 2021 12:20:00 +0300

View File

@ -1173,20 +1173,32 @@ 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 stringLengthDiff [expr [string length $findString] - [string length $replaceString]]
set i 0 set i 0
foreach ind $lstFindIndex { foreach ind [lsort -dictionary -decreasing $lstFindIndex] {
set selFindLine [lindex [split $ind "."] 0] set selFindLine [lindex [split $ind "."] 0]
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
# Вычисляем индекс вхождения строки после замены для выделения в тексте
if {$stringLengthDiff > 0} {
$txt tag add sel $ind "$endInd - [expr [tcl::mathfunc::abs $stringLengthDiff]] chars"
} else {
$txt tag add sel $ind "$endInd + [expr [tcl::mathfunc::abs $stringLengthDiff]] chars"
} }
} else {
$txt tag add sel $ind $endInd $txt tag add sel $ind $endInd
}
incr i incr i
} }
.finddialog.lblCounter configure -text "[::msgcat::mc "Finded"]: $i" .finddialog.lblCounter configure -text "[::msgcat::mc "Finded"]: $i"

View File

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