fix Alt-e command (proc open_sub_schematic) if no raw file loaded

This commit is contained in:
stefan schippers 2024-03-26 11:30:02 +01:00
parent 27f41119d8
commit 3dcda64367
1 changed files with 5 additions and 2 deletions

View File

@ -3205,6 +3205,7 @@ proc save_file_dialog { msg ext global_initdir {initialf {}} {overwrt 1} } {
# opens indicated instance (or selected one) into a separate tab/window
# keeping the hierarchy path, as it was descended into (as with 'e' key).
proc open_sub_schematic {{inst {}} {inst_number 0}} {
set rawfile {}
set one_sel [expr {[xschem get lastsel] == 1}]
if { $inst eq {} && $one_sel} {
set inst [lindex [xschem selected_set] 0]
@ -3217,8 +3218,10 @@ proc open_sub_schematic {{inst {}} {inst_number 0}} {
if {[lsearch -exact $instlist $inst] == -1} {return 0}
}
# open a new top level in another window / tab
set rawfile [xschem raw_query rawfile]
set sim_type [xschem raw_query sim_type]
if {[xschem raw loaded] >= 0} {
set rawfile [xschem raw_query rawfile]
set sim_type [xschem raw_query sim_type]
}
set res [xschem schematic_in_new_window force]
# if successfull descend into indicated sub-schematic
if {$res} {