Repository navigation
Track only this manager's commands as persisted after a save [patch] - #216
Merged
Merged
Conversation
SaveAsync recorded every command it wrote as persisted by this manager, including stored commands it only carried through for another manager. The next save then read those as unregistered here and dropped them from commands.json, so a second save deleted the other manager's commands and left their bindings dead. Record only the commands registered here, as the profile path already does. Fixes #214 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5MyZsxEdt96yVWhKn
|
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.



Fixes #214
What changed
After writing
commands.json,KeybindingManager.SaveAsyncrecorded every id it wrote in_persistedCommandIds. That included stored commands it had only carried through for another manager. On the next save, the merge read each of those as "persisted by me and no longer registered", so it dropped them from the file.The post-save bookkeeping now records only the ids registered in this manager (
commandIds), which mirrors the profile path. A command this manager unregisters is still removed, because it is absent fromcommandIdsand the persisted set no longer holds it after the save that drops it.This is a one-line change inside the post-save
lockblock. Open PR #204 (#195) reworks the read and merge just above it, but leaves that block alone. I checked withgit merge-treethat this branch and #204 merge cleanly in either order.Tests (
SaveWithoutInitializeTests)SaveAsync_TwiceWithoutInitialize_KeepsStoredCommands: repro A.file.saveand its Ctrl+S binding survive a reload after a second uninitialised save.SaveAsync_TwiceAfterAnotherManagerSaved_KeepsItsCommand: repro B.b.cmdsurvivesasaving twice afterbsaved.SaveAsync_CommandUnregisteredAfterItsFirstSave_IsRemovedOnTheNext: guard. A command registered, saved, then unregistered in the same manager is still deleted on the next save.With the
KeybindingManager.cschange reverted, the first two fail. The guard passes either way by design. With the change, the full suite passes: 331/331.Generated by Claude Code