🐛 fix(vscode): URI 开终端复用已有标签组,不再强制劈栏

This commit is contained in:
cruldra committed 2026-09-04 12:21:19 +08:00
1 parent f4b1d80105
commit 0e144bc28f
3 files changed
+62 -4

No files matched your search

+29 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { terminalEditorColumn } from '../terminalColumn'
import { existingTerminalGroupColumn, terminalEditorColumn } from '../terminalColumn'
describe('terminalEditorColumn', () => {
it('分屏 → 右侧第 2 栏', () => {
@@ -9,3 +9,31 @@ describe('terminalEditorColumn', () => {
expect(terminalEditorColumn(false)).toBe(-1)
})
})
describe('existingTerminalGroupColumn', () => {
it('没有任何终端 tab → -1', () => {
expect(existingTerminalGroupColumn([
{ viewColumn: 1, isActive: true, tabs: [{ isTerminal: false }] },
])).toBe(-1)
})
it('已有一组含终端 → 该组 viewColumn', () => {
expect(existingTerminalGroupColumn([
{ viewColumn: 1, isActive: true, tabs: [{ isTerminal: true }] },
])).toBe(1)
})
it('多组时活动组有终端 → 活动组', () => {
expect(existingTerminalGroupColumn([
{ viewColumn: 1, isActive: false, tabs: [{ isTerminal: true }] },
{ viewColumn: 2, isActive: true, tabs: [{ isTerminal: true }] },
])).toBe(2)
})
it('多组时活动组没有终端、另一组有 → 有终端的那组', () => {
expect(existingTerminalGroupColumn([
{ viewColumn: 1, isActive: false, tabs: [{ isTerminal: true }] },
{ viewColumn: 2, isActive: true, tabs: [{ isTerminal: false }] },
])).toBe(1)
})
})