Skip to content

fix: undo per-file survival, GFM tables, notification crash, version 1.0.9#117

Merged
hybridmachine merged 3 commits into
macos-portfrom
fix/undo-per-file-survive-tab-switch
Jun 14, 2026
Merged

fix: undo per-file survival, GFM tables, notification crash, version 1.0.9#117
hybridmachine merged 3 commits into
macos-portfrom
fix/undo-per-file-survive-tab-switch

Conversation

@hybridmachine

Copy link
Copy Markdown
Owner

Summary

This PR bundles several bug fixes and a version bump:

  • Preserve per-file undo buffer across tab switches — Each tab now owns a Scintilla Document via SCI_CREATEDOCUMENT/SCI_SETDOCPOINTER, so undo history, change history markers, and bookmarks survive tab switches. Fixes change markers painting all lines as modified and undo buffer being emptied on tab switch.
  • Prevent Ctrl+Z from emptying fileSCI_EMPTYUNDOBUFFER is now called after SCI_SETSAVEPOINT for new tabs, and conflicting Cmd+Z/Cmd+Shift+Z key bindings are removed from Scintilla's internal keymap. Adds defensive SCI_CANUNDO/SCI_CANREDO guards in the WM_COMMAND handler.
  • Fix GFM table delimiter validation — Requires at least 3 dashes per delimiter column, matching the GFM spec.
  • Fix NSVisualEffectView dealloc crash — Changed notification observer object: parameters from dangling-capable pointers to nil in ScintillaView.mm, and balanced retained Scintilla bridge views in applicationWillTerminate:.
  • Bump version to 1.0.9 and add C# document type to Info.plist.
  • Update project documentation — AGENTS.md, CLAUDE.md, DEVELOPER_GUIDE.md, README.md.

Test Plan

This is a macOS app with no automated test suite. Manual verification:

  • Open multiple tabs, make edits, switch tabs — confirm undo history is preserved per-tab
  • Ctrl+Z on a newly-opened file does not empty the file
  • GFM tables with 2-dash delimiters are not parsed as tables
  • App launches and switches tabs without crashes

🤖 Generated with Claude Code

Brian Tabone and others added 3 commits June 13, 2026 22:03
…ches

Adopt Scintilla's document pointer mechanism for per-tab document state
instead of serializing/deserializing text on every tab switch.  Each tab
now owns a Scintilla Document (via SCI_CREATEDOCUMENT), and tab switching
uses SCI_SETDOCPOINTER to swap documents — preserving undo history,
change history markers, and bookmarks natively.

This matches upstream Notepad++'s architecture and the pattern already
used by the document map (document_map.mm).

Fixes two bugs:
- Change history markers incorrectly painting all lines after switching
  back to a tab (SCI_SETTEXT marked every line as modified)
- Undo buffer (Ctrl+Z) empty after navigating away from and back to
  a tab (SCI_EMPTYUNDOBUFFER destroyed all undo history)

Co-Authored-By: Claude <noreply@anthropic.com>
When a new tab is created with the Document pointer approach
(SCI_CREATEDOCUMENT + SCI_SETDOCPOINTER), SCI_SETTEXT wraps the initial
content load in an UndoGroup, leaving one undo action on the stack.
Without SCI_EMPTYUNDOBUFFER, undoing past the save point reverted that
initial content insertion, emptying the file.

- Add SCI_EMPTYUNDOBUFFER after SCI_SETSAVEPOINT in document_manager.mm
  and split_view.mm (the legacy fallback path already had this call)
- Remove conflicting Cmd+Z/Cmd+Shift+Z key bindings from Scintilla's
  internal keymap to eliminate double-fire with the menu system
- Add defensive SCI_CANUNDO/SCI_CANREDO guards in the WM_COMMAND handler

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 04:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hybridmachine hybridmachine merged commit 48886ab into macos-port Jun 14, 2026
17 of 21 checks passed
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.

2 participants