Skip to content

feat(overlay): text diff animation, auto-dismiss, and settings fixes#75

Closed
foru17 wants to merge 40 commits into
missuo:mainfrom
foru17:feat/templates-trigger-workflow
Closed

feat(overlay): text diff animation, auto-dismiss, and settings fixes#75
foru17 wants to merge 40 commits into
missuo:mainfrom
foru17:feat/templates-trigger-workflow

Conversation

@foru17

@foru17 foru17 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Inline diff animation: Character-level diff between ASR and LLM-corrected text — deleted chars fade out in soft red, insertions highlight in blue-lavender, adjacent delete+insert pairs merge into clean replacements. Falls back to crossfade beyond 500 chars.
  • Auto-dismiss on any key press: After text is pasted, pressing any key (except template shortcuts 1-9) immediately dismisses the overlay so users can keep typing.
  • Settings fixes: Test result label repositioned inline next to Test button (no longer hidden behind fields), Save no longer closes the window, ASR test messages switched to English, overlay preview text updated.
  • Code review fixes: Overlay stays click-through during linger (no longer blocks clicks on apps underneath), template editor preserves system_prompt_path by writing back to the file instead of silently converting to inline.

Test plan

  • Voice input → verify diff animation shows red/blue highlights, then fades to final text
  • After paste, press any key → overlay should dismiss immediately
  • After paste, press 1-9 → template rewrite should trigger (not dismiss)
  • ASR settings → click Test → result shows in English next to the button
  • Settings → click Save → window stays open
  • Click on app behind overlay during linger → click should pass through
  • Edit a file-backed template prompt → save → verify the .txt file is updated (not converted to inline)

🤖 Generated with Claude Code

foru17 and others added 30 commits April 9, 2026 11:17
…ation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…modernization

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…yConfig

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nerate C header

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e display

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gger mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tes JSON query

Add two new FFI entry points:
- sp_core_get_prompt_templates_json: returns JSON array of template names and shortcuts
- sp_core_rewrite_with_template: runs async LLM rewrite using a specific prompt template,
  delivering results via on_rewrite_text_ready callback

Also adds current_session_token field to Core struct to track the active session token
for routing rewrite callbacks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mplate methods

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… hover support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…y monitoring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… keys

- Button bar now appears above the main pill (avoids Dock overlap)
- Buttons show name only (no shortcut numbers)
- Replace addGlobalMonitor with CGEventTap for reliable global key capture
- Highlight animation on button selection before triggering rewrite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…bar visuals

- Number key detection via SPHotkeyMonitor.numberKeyHandler (proven CGEventTap)
- Button bar gets dark tint overlay + glow shadow to match main pill
- Remove unused separate CGEventTap approach from AppDelegate

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e bar

CGEventTap and NSEvent global monitors couldn't capture regular key
events from other apps. Instead, make the button bar panel a key
window (canBecomeKeyWindow + makeKeyAndOrderFront) so it directly
receives keyDown: events. NSNonactivatingPanel ensures this doesn't
steal focus from the user's app.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When user selects a template rewrite, first simulate Cmd+Z to undo
the default correction paste, then Cmd+V to paste the rewrite result.
This replaces the previously pasted text instead of appending.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed Cmd+Z undo approach — unsafe in terminals (sends SIGTSTP).
Rewrite result is copied to clipboard; user pastes manually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mation

- Remove NSBezelStyleInline (ugly system focus ring)
- Borderless buttons with rounded pill shape, subtle white bg (10% alpha)
- Selection: dim other buttons to 30%, brighten selected to 30% white bg
- Smooth 0.25s hold before dismissing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rust: sp_core_set_prompt_templates_json FFI function to save templates
- Bridge: setPromptTemplates: method
- UI: New "Templates" tab with list view, add/remove buttons, name + prompt editor
- Templates are saved to config.yaml and reloaded immediately

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace fragile viewWithTag:1001 with templateNameField property
- Save current template edits before switching to another tab
- Disable name/prompt fields when no template is selected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use syncCurrentTemplateToData for consistent save logic
- Fix prompt content being wiped when switching between templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…switch

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
reloadData triggers table selection callbacks which were syncing empty
editor content back into template data. Now all reloadData calls are
wrapped with suppressTemplateSync to prevent this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
foru17 and others added 10 commits April 9, 2026 14:24
Action callbacks fire unpredictably during reloadData. The delegate
method with suppressTemplateSync guard is more reliable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Root cause: reloadData triggers selection callbacks which write empty
editor content back to data, corrupting templates.

New design:
- flushEditorToIndex: writes editor → data[index] (explicit only)
- loadEditorFromIndex: loads data[index] → editor (read only)
- tableViewSelectionDidChange: flush OLD row, then load NEW row
- suppressTemplateSync guards all reloadData calls
- Save button calls flushEditorToIndex before persisting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- add overlay prompt templates with settings management and rewrite actions
- add trigger-mode switching and custom shortcut recording
- simplify runtime hotkeys to a single trigger shortcut model
- refresh release docs, changelog, and update feed for 1.0.14
…ition

After text is pasted into the target app, pressing any key (except 1-9
template shortcuts) now immediately dismisses the overlay instead of
waiting for the linger timer. Also adds a 0.25s crossfade animation
when display text changes (ASR → LLM corrected text).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add character-level diff animation showing what changed between ASR and
LLM-corrected text: deleted chars fade out in soft red, inserted chars
highlight in blue-lavender, adjacent delete+insert pairs merge into
clean replacements. Animation plays over 0.8s then crossfades to final.

Also fix two settings bugs:
- Test result label now appears inline next to the Test button instead
  of being hidden behind configuration fields
- Save no longer closes the settings window, letting users continue
  editing other tabs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Diff animation: add 500-char threshold, beyond which falls back to
   simple crossfade. Fix O(n²) backtracking by appending forward then
   reversing once instead of insertObject:atIndex:0.

2. Overlay click-through: main pill panel stays ignoresMouseEvents=YES
   during linger and diff animation. Only the template button bar
   (separate panel) accepts mouse events. Prevents blocking clicks on
   the app underneath.

3. Template system_prompt_path: when a template references an external
   file and the user edits its content, write changes back to the file
   instead of silently converting to an inline prompt. Preserves the
   file-backed relationship.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all Chinese test result messages with English to match the
overall English UI. Update overlay preview sample text to a more
natural conversational example.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@foru17

foru17 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by a rebased PR on clean branch to resolve conflicts.

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.

1 participant