Repository navigation
Ask before replacing a keyloom.yml changed outside Keyloom - #38
Merged
Merged
Conversation
Keyloom rewrites keyloom.yml from its own rule model, so anything edited into the file by hand disappeared at the next change, and a file Keyloom never wrote was backed up and replaced without a word. Generated files now carry a checksum of themselves on the line after the marker, which tells Keyloom's own output from a file edited since. A file that was edited, or that Keyloom did not write, is left alone at launch. A change that would rewrite it asks first: keep a copy and replace, replace, or cancel, which leaves the file as it is and takes the change back so the interface never shows a remap that was not written. A change is saved only once the file is written, and one that leaves the document as it was (a rename) does not ask. A file from a version before checksums carries none and counts as untouched.
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.
What
Keyloom rewrites
~/.config/xremap/keyloom.ymlfrom its own rule model, so anything edited into the file by hand disappeared the next time a mapping changed. A file Keyloom never wrote was backed up and replaced silently. This implements the "Noticing edits to the config file" entry fromdocs/Upcoming_Features.md.Behaviour
# Checksum: <sha256>comment on the line after the marker. A file whose contents no longer match is treated as edited by hand; a file without the marker is treated as not written by Keyloom. Both are handled the same way.keyloom.yml.bak[.N], names the copy in a toast, and writes.Behaviour changes to note
Limitations
docs/Upcoming_Features.md.Implementation
src/xremap.rs:seal/edited_since_sealed, aReplacepolicy in place of theoverwrite_foreignflag, and newWriteOutcomevariants.src/app.rs: the last saved profile state is kept so a cancelled change can be taken back (discard_change); the dialog's state and messages.src/ui/overlays.rs: the dialog.src/app/screenshots.rs: an ignored screenshot test for the dialog.Validation
cargo fmt --all -- --check,cargo clippy --all-targets --all-features --locked -- -D warnings, andcargo test --locked(352 passed) pass.verify-layers-with-xremap.shwas not run: what the generator emits is unchanged, since the checksum is added only when the file is written.