11<script lang="ts" setup>
22import type { TerminalTab } from ' @commas/types/terminal'
33import * as commas from ' commas:api/renderer'
4+ import { watch } from ' vue'
45import FileExplorer from ' ./FileExplorer.vue'
56import { getDirectoryProcess } from ' ./compositions'
67
78const { tab } = defineProps <{
89 tab: TerminalTab ,
910}>()
1011
11- const { TerminalBlock, VisualIcon } = commas .ui .vueAssets
12+ const { TerminalBlock } = commas .ui .vueAssets
1213
1314let directory = $computed ({
1415 get : () => tab .cwd ,
@@ -29,31 +30,19 @@ const target = $computed(() => {
2930 if (teletypes .length === 1 ) return teletypes [0 ]
3031})
3132
32- const isConnected = $computed (() => {
33- if (! target ) return false
34- return ! target .pane && target .idle
35- })
36-
37- function send() {
38- if (! target ) return
33+ watch ($$ (directory ), () => {
34+ if (! target || target .pane || ! target .idle ) return
3935 const command = commas .workspace .getTerminalExecutorCommand ({
4036 directory ,
4137 shell: target .shell ,
4238 })
4339 commas .workspace .executeTerminalTab (target , command )
44- setTimeout (() => {
45- commas .workspace .activateTerminalTab (target )
46- })
47- }
40+ })
4841 </script >
4942
5043<template >
5144 <TerminalBlock :tab =" tab" class =" file-editor-pane" >
52- <FileExplorer v-model =" directory" >
53- <button v-if =" isConnected" type =" button" data-commas @click =" send" >
54- <VisualIcon name =" lucide-arrow-right" />
55- </button >
56- </FileExplorer >
45+ <FileExplorer v-model =" directory" />
5746 </TerminalBlock >
5847</template >
5948
0 commit comments