ctrl-Tab: toggle to previously active tab: make it work also after new tab creation

This commit is contained in:
stefan schippers 2025-08-22 15:39:19 +02:00
parent fc6fefff35
commit f27d4b9773
2 changed files with 5 additions and 2 deletions

View File

@ -44,6 +44,7 @@ static char window_path[MAX_NEW_WINDOWS][WINDOW_PATH_SIZE];
static int window_count = 0;
static int last_created_window = -1;
static Xschem_ctx *old_xctx;
static char previous_win_path[200] = "";
/* ----------------------------------------------------------------------- */
/* EWMH message handling routines 20071027... borrowed from wmctrl code */
@ -1569,7 +1570,6 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
static int switch_tab(int *window_count, const char *win_path, int dr)
{
int n;
static char previous_win_path[200] = "";
const char *new_path = win_path;
dbg(1, "switch_tab(): win_path=%s\n", win_path);
if(xctx->semaphore) return 1; /* some editing operation ongoing. do nothing */
@ -1794,6 +1794,9 @@ static void create_new_tab(int *window_count, const char *noconfirm, const char
my_snprintf(win_path, S(win_path), ".x%d.drw", i);
my_strncpy(window_path[i], win_path, S(window_path[i]));
if(xctx->current_win_path) {
my_strncpy(previous_win_path, xctx->current_win_path, sizeof(previous_win_path));
}
old_xctx = xctx;
xctx = NULL;
alloc_xschem_data("", win_path); /* alloc data into xctx */

View File

@ -8168,7 +8168,7 @@ proc swap_tabs {x y what} {
button .tabs.mm -padx 2 -pady 0 -anchor nw -takefocus 0 -text [$tctx::source_swap_tab cget -text]
bind . <B1-Motion> {
place .tabs.mm -x [expr {[getmousex .tabs]-[winfo width .tabs.mm]/2 }] -y 0
raise .tabs.mm
# raise .tabs.mm
}
}
} else {