ui: Limit the number of window splits to 6

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2025-09-04 09:38:33 +08:00
parent 94d2a5edc3
commit bebc7d1f4b
3 changed files with 15 additions and 4 deletions

View File

@@ -96,5 +96,6 @@
"Match Case": "Match Case",
"Whole Word": "Whole Word",
"Regular": "Regular",
"Clear Highlighting": "Clear Highlighting"
}
"Clear Highlighting": "Clear Highlighting",
"windows-limit": "Maximum number of windows ({n}) reached"
}

View File

@@ -96,5 +96,6 @@
"Match Case": "匹配大小写",
"Whole Word": "匹配整个单词",
"Regular": "正则匹配",
"Clear Highlighting": "清除高亮"
}
"Clear Highlighting": "清除高亮",
"windows-limit": "已达到最大窗口数量({n}个)"
}

View File

@@ -9,6 +9,8 @@
import RttySplitter from '../components/RttySplitter.vue'
import RttyTerm from '../components/RttyTerm.vue'
import { ref, computed, onMounted, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
defineProps({
devid: {
@@ -17,6 +19,8 @@ defineProps({
}
})
const { t } = useI18n()
const paneRootID = 'rtty-panel-root'
const rootConfig = ref({
@@ -87,6 +91,11 @@ const deletePanel = (config, panelId, index, parent) => {
}
const handleSplitPanel = (panelId, direction) => {
if (terms.value.length > 5) {
ElMessage.warning(t('windows-limit', { n: 6 }))
return
}
moveTerminalsToPool()
splitPanel(rootConfig.value, panelId, 0, direction)
moveTerminalsToPlaceholders()