Skip to content

Commit

Permalink
feat: auto select custom title
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Jul 13, 2024
1 parent f39599e commit 302f98a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/renderer/components/TabItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { watchEffect } from 'vue'
import { nextTick, watchEffect } from 'vue'
import type { TerminalTab, TerminalTabCharacter } from '../../typings/terminal'
import type { IconEntry } from '../assets/icons'
import { useSettings } from '../compositions/settings'
Expand Down Expand Up @@ -67,14 +67,19 @@ const title = $computed(() => {
let isCustomizing = $ref(false)
let customTitle: string = $ref('')
let customTitleElement = $ref<HTMLInputElement>()
watchEffect(() => {
customTitle = title
})
function startCustomization() {
async function startCustomization() {
if (customizable && isActive) {
isCustomizing = true
await nextTick()
if (customTitleElement) {
customTitleElement.select()
}
}
}
Expand Down Expand Up @@ -132,6 +137,7 @@ function close() {
<VisualIcon v-else name="lucide-terminal" class="tab-icon" />
<input
v-if="isCustomizing"
ref="customTitleElement"
v-model="customTitle"
autofocus
class="custom-tab-name"
Expand Down

0 comments on commit 302f98a

Please sign in to comment.