Исправлена ошибка с закрытием файлов в редакторе при закрытии папки

This commit is contained in:
svkalinin 2022-11-25 08:07:55 +03:00
parent 167c374b9d
commit 0fcc2a652f

View File

@ -147,7 +147,7 @@ namespace eval FileOper {
# .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" # .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
return $fullPath return $fullPath
} }
proc CloseFolder {} { proc CloseFolder {} {
global tree nbEditor activeProject global tree nbEditor activeProject
@ -157,14 +157,18 @@ namespace eval FileOper {
set treeItem $parent set treeItem $parent
set parent [$tree parent $treeItem] set parent [$tree parent $treeItem]
} }
set upper [Tree::GetUpperItem $tree $treeItem]
if {$parent eq "" && [string match "directory::*" $treeItem] == 1} { if {$parent eq "" && [string match "directory::*" $treeItem] == 1} {
# puts "tree root item: $treeItem" # puts "tree root item: $treeItem"
set proj [string trimleft $upper "directory::"]
foreach nbItem [$nbEditor tabs] { foreach nbItem [$nbEditor tabs] {
set item [string trimleft [file extension $nbItem] "."] set item [string trimleft [file extension $nbItem] "."]
# puts $item # puts "$upper $item"
if [$tree exists "file::$item"] { if [string match "$proj*" $item] {
$nbEditor select $nbItem if [$tree exists "file::$item"] {
Close $nbEditor select $nbItem
Close
}
} }
} }
set nextProj [$tree next $treeItem] set nextProj [$tree next $treeItem]
@ -173,10 +177,10 @@ namespace eval FileOper {
# puts $prevProj # puts $prevProj
if {$nextProj ne ""} { if {$nextProj ne ""} {
SetActiveProject [$tree item $nextProj -values] SetActiveProject [$tree item $nextProj -values]
puts $activeProject # puts $activeProject
} elseif {$prevProj ne ""} { } elseif {$prevProj ne ""} {
SetActiveProject [$tree item $prevProj -values] SetActiveProject [$tree item $prevProj -values]
puts $activeProject # puts $activeProject
} else { } else {
unset activeProject unset activeProject
.frmStatus.lblGitLogo configure -image pixel .frmStatus.lblGitLogo configure -image pixel