@@ -46,10 +46,7 @@ function App() {
4646 const logEndRef = useRef < HTMLDivElement > ( null ) ;
4747 const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
4848
49- // 历史与智能补全
50- const [ cmdHistory , setCmdHistory ] = useState < string [ ] > ( [ ] ) ;
51- const [ historyIdx , setHistoryIdx ] = useState < number > ( - 1 ) ;
52- const draftRef = useRef ( "" ) ;
49+ // 智能补全
5350 const [ suggestions , setSuggestions ] = useState < QuickCommand [ ] > ( [ ] ) ;
5451 const [ suggestionIdx , setSuggestionIdx ] = useState ( 0 ) ;
5552 const suggestionsListRef = useRef < HTMLDivElement > ( null ) ;
@@ -165,8 +162,6 @@ function App() {
165162 const handleSend = async ( ) => {
166163 const success = await executeSend ( sendText , isHexSend , appendCrlf ) ;
167164 if ( success ) {
168- if ( sendText . trim ( ) ) setCmdHistory ( prev => prev [ prev . length - 1 ] === sendText ? prev : [ ...prev , sendText ] ) ;
169- setHistoryIdx ( - 1 ) ; draftRef . current = "" ;
170165 if ( clearAfterSend ) { setSendText ( "" ) ; setSuggestions ( [ ] ) ; }
171166 setTimeout ( ( ) => textareaRef . current ?. focus ( ) , 50 ) ;
172167 }
@@ -481,7 +476,7 @@ function App() {
481476 </ div >
482477 < div style = { { fontSize : "13px" , color : "#666" , fontFamily : "monospace" , wordBreak : "break-all" } } > { cmd . data } </ div >
483478 </ div >
484- < button onClick = { ( ) => setQuickCommands ( prev => prev . filter ( c => c . id !== cmd . id ) ) } style = { { border : "none" , background : "#fff1f0" , color : "#ff4d4f" , cursor : "pointer" , fontSize : "13px" , padding : "6px 12px" , borderRadius : "4px" , border : "1px solid #ffa39e" } } > 删除</ button >
479+ < button onClick = { ( ) => setQuickCommands ( prev => prev . filter ( c => c . id !== cmd . id ) ) } style = { { background : "#fff1f0" , color : "#ff4d4f" , cursor : "pointer" , fontSize : "13px" , padding : "6px 12px" , borderRadius : "4px" , border : "1px solid #ffa39e" } } > 删除</ button >
485480 </ div >
486481 ) ) }
487482 </ div >
0 commit comments