Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

Custom rewrites in the proof mode rewrites panel lacked management options available in the patterns sidebar. Right-clicking now provides Edit, Rename, Delete, and Show in folder operations.

Changes

zxlive/rewrite_data.py

  • Added file_path field to RewriteData TypedDict
  • Modified read_custom_rules() to capture file paths when loading .zxr files

zxlive/rewrite_action.py

  • Added is_custom_rule and file_path fields to RewriteAction dataclass
  • Enhanced show_context_menu() to conditionally render menu items based on rule type
  • Implemented handlers:
    • _edit_custom_rule() - opens file in editor via open_file_from_path()
    • _rename_custom_rule() - renames file with duplicate validation
    • _delete_custom_rule() - deletes file after confirmation dialog
    • _show_in_folder() - opens containing directory (cross-platform)

Context Menu Behavior

# Custom rules show full options
if is_custom and rewrite_action and rewrite_action.file_path:
    menu.addAction("Edit")
    menu.addAction("Rename")
    menu.addSeparator()
    menu.addAction("Delete")
    menu.addSeparator()
    menu.addAction("Show in folder")

# Built-in rules show only refresh
menu.addAction("Refresh rules")

Pattern follows PatternsListWidget implementation in editor_base_panel.py while adapting to proof panel context (.zxr vs .zxg, proof_panel vs parent_panel).

Original prompt

This section details on the original issue you should resolve

<issue_title>More context menu options for custom rewrites in proof mode rewrites panel</issue_title>
<issue_description>Right clicking a custom rewrite in the proof mode creates a context menu. It should additionally have the following options:

  1. Edit (or open?)
  2. Rename
  3. Delete
  4. Show in folder

The patterns sidebar in editor_base_panel also implements similar features. So this should avoid code duplication if possible.</issue_description>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add context menu options for custom rewrites in proof mode Add context menu options for custom rewrites in proof mode Nov 3, 2025
Copilot AI requested a review from RazinShaikh November 3, 2025 18:40
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.

More context menu options for custom rewrites in proof mode rewrites panel

2 participants