Compare commits

..

No commits in common. "c9e804b6141a8523000aded0e7fe16a3d3a79735" and "f68cd75600563c09dfc08b4eb2be7561c95b0ac2" have entirely different histories.

3 changed files with 8 additions and 26 deletions

10
debian/changelog vendored
View File

@ -1,11 +1,5 @@
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, 27 Nov 2021 12:20:00 +0300 -- Sergey Kalinin <svk@nuk-svk.ru> Wed, 20 Jul 2022 16:56:31 +0300

View File

@ -1173,32 +1173,20 @@ 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 [lsort -dictionary -decreasing $lstFindIndex] { foreach ind $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: 17072024122602 # Build: 24062024101337
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.