fix: undo per-file survival, GFM tables, notification crash, version 1.0.9#117
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR bundles several bug fixes and a version bump:
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.SCI_EMPTYUNDOBUFFERis now called afterSCI_SETSAVEPOINTfor new tabs, and conflicting Cmd+Z/Cmd+Shift+Z key bindings are removed from Scintilla's internal keymap. Adds defensiveSCI_CANUNDO/SCI_CANREDOguards in the WM_COMMAND handler.object:parameters from dangling-capable pointers tonilinScintillaView.mm, and balanced retained Scintilla bridge views inapplicationWillTerminate:.Test Plan
This is a macOS app with no automated test suite. Manual verification:
🤖 Generated with Claude Code