From f9d3661c1505e5297e76d6e37a52ac6cc7192362 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 25 Oct 2023 16:47:11 +0200 Subject: [PATCH] fix tab context menu close (invalid switching after deletion) --- src/xschem.tcl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 0524c2c3..d0c9eb60 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5604,9 +5604,13 @@ proc tab_ctx_cmd {tab_but what} { xschem new_schematic switch $old {} 0 ;# no draw } elseif {$what eq {close}} { set old [xschem get current_win_path] + set ntabs [xschem get ntabs] xschem new_schematic switch $win_path {} 0 ;# no draw - xschem exit - xschem new_schematic switch $old {} 1 ;# draw + set remaining_tabs [xschem exit] + if { $old != $win_path || $remaining_tabs == $ntabs} { + # don't switch if we were on the tab that has been closed. + xschem new_schematic switch $old {} 1 ;# draw + } } } # puts $filename