mux-sesh 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app.tsx +2 -1
- package/src/ui/SearchInput.tsx +19 -1
package/package.json
CHANGED
package/src/app.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TextareaRenderable } from '@opentui/core'
|
|
1
2
|
import { useKeyboard } from '@opentui/react'
|
|
2
3
|
import { useState, useEffect, useRef } from 'react'
|
|
3
4
|
import { AppMode, ViewMode, type Item, type Config, type OpencodeStatsState } from './types'
|
|
@@ -49,7 +50,7 @@ export function App() {
|
|
|
49
50
|
const [config, setConfig] = useState<Config | null>(null)
|
|
50
51
|
const [prefixActive, setPrefixActive] = useState(false)
|
|
51
52
|
const prefixTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
52
|
-
const textareaRef = useRef<
|
|
53
|
+
const textareaRef = useRef<TextareaRenderable | null>(null)
|
|
53
54
|
const { columns } = useTerminalSize()
|
|
54
55
|
const [toastMessage, setToastMessage] = useState('')
|
|
55
56
|
const [toastVisible, setToastVisible] = useState(false)
|
package/src/ui/SearchInput.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
+
import { useEffect } from 'react'
|
|
1
3
|
import { AppMode } from '../types'
|
|
2
4
|
|
|
3
5
|
interface Props {
|
|
4
6
|
appMode: AppMode
|
|
5
7
|
searchQuery: string
|
|
6
|
-
textareaRef:
|
|
8
|
+
textareaRef: { current: TextareaRenderable | null }
|
|
7
9
|
onContentChange: () => void
|
|
8
10
|
prefixActive?: boolean
|
|
9
11
|
}
|
|
@@ -22,6 +24,22 @@ export default function SearchInput({
|
|
|
22
24
|
? 'Enter new session name...'
|
|
23
25
|
: 'Type to search...'
|
|
24
26
|
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (appMode !== AppMode.Rename) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
queueMicrotask(() => {
|
|
33
|
+
const textarea = textareaRef.current
|
|
34
|
+
if (!textarea) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
textarea.focus()
|
|
39
|
+
textarea.gotoLineEnd()
|
|
40
|
+
})
|
|
41
|
+
}, [appMode, textareaRef])
|
|
42
|
+
|
|
25
43
|
return (
|
|
26
44
|
<box
|
|
27
45
|
style={{
|