(commandName: string)
| 373 | |
| 374 | // Handle slash command selection |
| 375 | const selectSlashCommand = (commandName: string) => { |
| 376 | const beforeCursor = inputText.slice(0, cursorPosition); |
| 377 | const lastSlashIndex = beforeCursor.lastIndexOf("/"); |
| 378 | |
| 379 | if (lastSlashIndex !== -1) { |
| 380 | const beforeSlash = inputText.slice(0, lastSlashIndex); |
| 381 | const afterCursor = inputText.slice(cursorPosition); |
| 382 | |
| 383 | // Replace the partial command with the full command |
| 384 | const newText = beforeSlash + "/" + commandName + " " + afterCursor; |
| 385 | const newCursorPos = lastSlashIndex + 1 + commandName.length + 1; |
| 386 | |
| 387 | textBuffer.setText(newText); |
| 388 | textBuffer.setCursor(newCursorPos); |
| 389 | setInputText(newText); |
| 390 | setCursorPosition(newCursorPos); |
| 391 | setShowSlashCommands(false); |
| 392 | setShowBashMode(false); |
| 393 | } |
| 394 | }; |
| 395 | |
| 396 | // Handle file selection |
| 397 | const selectFile = async (filePath: string) => { |
no test coverage detected