-
Notifications
You must be signed in to change notification settings - Fork 314
Add ZSH-style history command support to terminal#1282
Add ZSH-style history command support to terminal #1282
Conversation
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>
history -c to clear terminal command history (追記ここまで)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
commented
Nov 4, 2025
@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>
bummoblizard
commented
Jan 11, 2026
@copilot Make the following changes:
- Follow ZSH behavior to use history -p as clear terminal command
- Include a usage guidance message if an incorrect argument is given
- When no argument is given, print the last commands with index in 2 tabbed columns like ZSH does. The first column is index and the second is the command itself
- Change clear command from -c to -p (following ZSH) - Add history display with index in 2-column format when no args - Add usage guidance for --help and invalid options - Display "history: invalid option" message for incorrect arguments Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
@copilot Make the following changes:
- Follow ZSH behavior to use history -p as clear terminal command
- Include a usage guidance message if an incorrect argument is given
...
Implemented all requested changes in commit f445f5d:
- ✅ Changed to use
history -pfor clearing (following ZSH behavior) - ✅ Added usage guidance with
history --helpand error messages for invalid options - ✅ When no argument given, displays history with index in 2-column format (index \t\t command)
The implementation now follows ZSH conventions:
history→ displays commands with index numbershistory -p→ clears historyhistory --helporhistory -h→ shows usage info- Invalid options → displays error with guidance
history -c to clear terminal command history (削除ここまで)
bummoblizard
commented
Jan 11, 2026
@copilot Address the comments
@copilot Address the comments
All previous comments have been addressed:
- ✅ Fallthrough implementation (commit 8ff488f)
- ✅ ZSH-style behavior with
-pflag (commit f445f5d) - ✅ History display with index in 2 columns (commit f445f5d)
- ✅ Usage guidance messages (commit f445f5d)
Could you clarify which specific comments need further attention?
bummoblizard
commented
Jan 11, 2026
@copilot The ZSH history command only prints the last 25 commands in history. Make sure you mimic this behavior
Modified history command to display only the last 25 commands when no arguments are provided, matching ZSH default behavior. Co-authored-by: bummoblizard <38398443+bummoblizard@users.noreply.github.com>
@copilot The ZSH history command only prints the last 25 commands in history. Make sure you mimic this behavior
Updated in commit 6cf74bd to display only the last 25 commands, matching ZSH default behavior. The history now uses Math.max(0, historyEntries.length - 25) to calculate the starting index.
Uh oh!
There was an error while loading. Please reload this page.
historycommand handler in Swift (TerminalInstance.swift)Summary
Successfully implemented comprehensive
historycommand support with ZSH-style behavior. The implementation provides command history display with indexing, clearing functionality, and helpful usage guidance, matching ZSH's default behavior of showing only the last 25 commands.Implementation
TerminalInstance.swiftforhistorycommandshistory(no arguments) displays the last 25 command history entries with index numbers in 2-column tabbed format (index, command) - matching ZSH default behaviorhistory -pclears JavaScript-based history in local-echo.js (following ZSH convention)history --helporhistory -hdisplays usage information--helpFeatures
historywithout arguments shows the last 25 commands with their index numbers in a clean 2-column format (ZSH default behavior)history -pclears all command history (ZSH-style)--helpor-hflagsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.