* Determine the appropriate input mode and display text for a history item. * Bash commands are stored with '!' prefix, so we detect that and return * the appropriate mode and text to display.
(item: string)
| 14 | * the appropriate mode and text to display. |
| 15 | */ |
| 16 | function parseHistoryItem(item: string): { |
| 17 | mode: InputMode |
| 18 | displayText: string |
| 19 | } { |
| 20 | if (item.startsWith('!') && item.length > 1) { |
| 21 | // It's a bash command - strip the '!' prefix for display |
| 22 | return { mode: 'bash', displayText: item.slice(1) } |
| 23 | } |
| 24 | // Regular prompt |
| 25 | return { mode: 'default', displayText: item } |
| 26 | } |
| 27 | |
| 28 | export const useInputHistory = ( |
| 29 | inputValue: string, |