Skip to content

feat(view): add undo/redo keyboard shortcuts for command editing#217

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/197
Dec 3, 2025
Merged

feat(view): add undo/redo keyboard shortcuts for command editing#217
kubrickcode merged 1 commit intomainfrom
develop/shlee/197

Conversation

@kubrickcode
Copy link
Owner

Implemented undo/redo functionality for command editing using zundo library

  • Manage state history with zustand + zundo based command-store (50 entries limit)
  • Support Ctrl+Z (undo), Ctrl+Shift+Z/Ctrl+Y (redo) keyboard shortcuts
  • Preserve native browser undo/redo behavior in editable fields
  • Auto-clear history on scope/button set changes
  • Added E2E tests

fix #197

@github-actions github-actions bot added improvement Improvements to existing features feature New feature labels Dec 3, 2025
@kubrickcode
Copy link
Owner Author

/gemini review

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces robust undo and redo capabilities for command editing within the application. By integrating the 'zustand' state management library with the 'zundo' middleware, users can now reverse or reapply changes to their command configurations using standard keyboard shortcuts, significantly enhancing the user experience and reducing potential errors. The implementation carefully distinguishes between application-level undo/redo and native browser functionality in input fields, ensuring a seamless interaction.

Highlights

  • Undo/Redo Functionality: Implemented global undo and redo capabilities for command editing actions, allowing users to reverse or reapply changes to their command configurations.
  • Keyboard Shortcuts: Standard keyboard shortcuts are supported: 'Ctrl+Z' for undo and 'Ctrl+Shift+Z' or 'Ctrl+Y' for redo.
  • State Management: The application now uses 'zustand' with the 'zundo' middleware to manage command history, with a limit of 50 entries, providing robust temporal state management.
  • Native Behavior Preservation: The undo/redo implementation intelligently preserves native browser undo/redo behavior within editable input fields, ensuring a seamless user experience.
  • History Clearing: Undo/redo history is automatically cleared when the command scope or button set changes, preventing irrelevant history from persisting.
  • End-to-End Tests: Comprehensive end-to-end tests have been added to validate the correct functioning of the new undo/redo feature across various command editing scenarios.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully implements undo/redo functionality for command editing by integrating zustand and zundo for state management. The introduction of a centralized command-store and a dedicated useUndoRedoShortcuts hook is a solid approach. The changes are also well-covered by new E2E tests. My review includes a few suggestions to enhance type safety, adhere to the style guide by removing magic numbers, and a refactoring proposal to further improve the state management architecture by co-locating state logic within the zustand store.

Implemented undo/redo functionality for command editing using zundo library

- Manage state history with zustand + zundo based command-store (50 entries limit)
- Support Ctrl+Z (undo), Ctrl+Shift+Z/Ctrl+Y (redo) keyboard shortcuts
- Preserve native browser undo/redo behavior in editable fields
- Auto-clear history on scope/button set changes
- Added E2E tests

fix #197
@kubrickcode kubrickcode merged commit 30cf581 into main Dec 3, 2025
5 of 6 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/197 branch December 3, 2025 12:32
@kubrickcode
Copy link
Owner Author

🎉 This PR is included in version 0.10.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature improvement Improvements to existing features released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undo/Redo System

1 participant