Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions webview-ui/src/components/chat/CommandExecution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const CommandExecution = ({ executionId, text }: CommandExecutionProps) =

const [status, setStatus] = useState<CommandExecutionStatus | null>(null)
const [output, setOutput] = useState("")
const [command, setCommand] = useState(text)
const [command, setCommand] = useState("")

const lines = useMemo(
() => [`$ ${command}`, ...output.split("\n").filter((line) => line.trim() !== "")],
Expand Down Expand Up @@ -79,9 +79,7 @@ export const CommandExecution = ({ executionId, text }: CommandExecutionProps) =
if (!status && text) {
const index = text.indexOf(COMMAND_OUTPUT_STRING)

if (index === -1) {
setCommand(text)
} else {
if (index !== -1) {
setCommand(text.slice(0, index))
setOutput(text.slice(index + COMMAND_OUTPUT_STRING.length))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the branch that sets command to text when COMMAND_OUTPUT_STRING is not found reintroduces the bug where a valid command isn't displayed. Ensure that for cases with no output marker (index === -1), command should be set to text.

Expand Down