MCPcopy
hub / github.com/wavetermdev/waveterm / switchTab

Function switchTab

frontend/app/store/keymodel.ts:295–313  ·  view source on GitHub ↗
(offset: number)

Source from the content-addressed store, hash-verified

293}
294
295function switchTab(offset: number) {
296 console.log("switchTab", offset);
297 const ws = globalStore.get(atoms.workspace);
298 const curTabId = globalStore.get(atoms.staticTabId);
299 let tabIdx = -1;
300 const tabids = getAllTabs(ws);
301 for (let i = 0; i < tabids.length; i++) {
302 if (tabids[i] == curTabId) {
303 tabIdx = i;
304 break;
305 }
306 }
307 if (tabIdx == -1) {
308 return;
309 }
310 const newTabIdx = (tabIdx + offset + tabids.length) % tabids.length;
311 const newActiveTabId = tabids[newTabIdx];
312 getApi().setActiveTab(newActiveTabId);
313}
314
315function handleCmdI() {
316 globalRefocus();

Callers 1

registerGlobalKeysFunction · 0.85

Calls 4

getApiFunction · 0.90
getAllTabsFunction · 0.85
getMethod · 0.80
setActiveTabMethod · 0.45

Tested by

no test coverage detected