codeapp icon indicating copy to clipboard operation
codeapp copied to clipboard

Add support for `history -c` to clear terminal command history

Open Copilot opened this issue 2 months ago • 2 comments

  • [x] Explore repository structure and understand terminal implementation
  • [x] Add custom history command handler in Swift (TerminalInstance.swift)
  • [x] Connect Swift handler to JavaScript function to clear history
  • [x] Address code review feedback (improve command parsing)
  • [x] Add detailed comments and maintain consistency with existing code
  • [x] Final code review - no issues found
  • [x] Security scan - no vulnerabilities
  • [x] Address PR review: Use fallthrough for cleaner code
  • [x] Complete task

Summary

Successfully implemented support for history -c command to clear terminal command history. The implementation has been refined based on code review to use fallthrough for better code organization.

Implementation

  • Added custom handler in TerminalInstance.swift for history commands
  • history -c clears JavaScript-based history in local-echo.js
  • Other history commands use fallthrough to delegate to default case
  • Includes comprehensive comments and validation
Original prompt

This section details on the original issue you should resolve

<issue_title>Cannot clear history of commands used in terminal</issue_title> <issue_description>In general (shell-based) terminal, running history -c can clear all the history of commands used. However, this sentence did not work in terminal of this APP and I did not find any other relevant setups except item Close Workspace, which seem to be unpractical for ongoing projects.</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes thebaselab/codeapp#1266

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Nov 04 '25 03:11 Copilot

@copilot evaluate my comment and make any necessary changes

bummoblizard avatar Nov 04 '25 04:11 bummoblizard

@copilot evaluate my comment and make any necessary changes

Updated to use fallthrough as requested in commit 8ff488f.

Copilot avatar Nov 04 '25 04:11 Copilot