From 478f1d156fa3fe4cfd7051af33d8fc7d41048243 Mon Sep 17 00:00:00 2001 From: svk Date: Fri, 30 Jan 2026 14:07:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20FileOper::SaveFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/files.tcl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/files.tcl b/lib/files.tcl index 04db052..4d301ed 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -364,7 +364,7 @@ namespace eval FileOper { set nbEditorWindow "[lindex $str 0].[lindex $str 1].[lindex $str 2]" # puts "FileOper::Save: current window $nbEditorWindow" } - # puts "FileOper::Save: $nbEditorWindow" + set nbEditorItem [$nbEditorWindow select] DebugPuts "Saved editor text: $nbEditorItem" if [string match "*untitled*" $nbEditorItem] { @@ -382,8 +382,13 @@ namespace eval FileOper { set treeItem "file::[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end ]" set filePath [Tree::GetItemID $tree $treeItem] } + if {![winfo exists $nbEditorItem.frmText.t]} { + DebugPuts "winfo exists $nbEditorWindow.frmText.t equal [winfo exists $nbEditorWindow.frmText.t]" + return + } set editedText [$nbEditorItem.frmText.t get 0.0 end] if {$type eq "saveas"} {set filePath [FileOper::SaveDialog]} + if {$filePath eq "cancel"} {return} DebugPuts "FileOper::Save $filePath" set f [open $filePath "w+"] puts -nonewline $f $editedText @@ -638,9 +643,10 @@ namespace eval FileOper { set dir $env(HOME) } set fileName [tk_getSaveFile -initialdir $dir -filetypes $::types -parent .] + if {$fileName eq ""} {return "cancel"} set fullPath [file join $dir $fileName] set file [string range $fullPath [expr [string last "/" $fullPath]+1] end] - DebugPuts "FileOper::SaveDialog $fullPath" + DebugPuts "FileOper::SaveDialog $fileName $fullPath" regsub -all "." $file "_" node set dir [file dirname $fullPath] set file [file tail $fullPath]