Skip to content

Conversation

Copy link

Copilot AI commented Nov 4, 2025

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


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

Copilot AI and others added 3 commits November 4, 2025 04:02
Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix command history clearing in terminal Add support for history -c to clear terminal command history Nov 4, 2025
Copilot AI requested a review from bummoblizard November 4, 2025 04:09
Copilot finished work on behalf of bummoblizard November 4, 2025 04:09
Comment on lines 330 to 337
} else {
// Display history - pass to ios_system for default behavior
executor?.dispatch(command: x, isInteractive: false) { _ in
DispatchQueue.main.async {
self.readLine()
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we use fallthrough here?

Copy link
Author

Choose a reason for hiding this comment

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

Good suggestion! Changed to use fallthrough in commit 8ff488f. This eliminates code duplication and makes it cleaner.

@bummoblizard
Copy link
Member

@copilot evaluate my comment and make any necessary changes

Use fallthrough to default case instead of duplicating dispatch logic,
as suggested in code review.

Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>

Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 4, 2025

@copilot evaluate my comment and make any necessary changes

Updated to use fallthrough as requested in commit 8ff488f.

Copilot AI requested a review from bummoblizard November 4, 2025 04:49
Copilot finished work on behalf of bummoblizard November 4, 2025 04:49
@bummoblizard bummoblizard marked this pull request as ready for review November 4, 2025 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot clear history of commands used in terminal

2 participants