fix(settings): harden settings and configuration file handling after schema refactoring - #134
Merged
Merged
Conversation
Invalid INI values (wrong booleans, out-of-choice or out-of-range values, applications set in both VimShiftEnter and VimCtrlEnter) used to throw an uncaught error in Initialize() and abort the startup. - Normalize values with per-key fallback to the default at startup, collecting warnings shown once after setup. OK/Apply in the GUI keep the strict validation. - Repair exclusive-group conflicts at startup by keeping an item in the first setting it appears in. - Validate booleans strictly (0/1 only) instead of treating any non-empty value as true. - Rewrite the configuration file after recovery to persist corrected values, guarded so a read-only file cannot break startup. - Do not register application groups without any rule so that IsConfiguredGroup() does not query group names that were never created. - Remove unused SetConfDefault().
Write only values which differ from the default and delete keys equal to the default, so that default value updates (e.g. new applications in VimShiftEnter) reach users who have saved their settings. The startup rewrite added in the previous commit migrates files written by older versions, which stored every setting. Seed the import staging map with the default values accordingly, so a key missing from an imported file means the default value. Keep the file itself even if all values are default, for Export.
Ignore a group selection change without a valid selection instead of throwing in the event handler, and remove WantTab from the group editor so that Tab moves the focus instead of inserting a tab character.
Validate vim.ahk with AutoHotkey v2 /validate on pull requests and pushes to master. The existing build workflow runs only on tags, so syntax errors were not caught before merging.
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.
Follow-up to #133, addressing the remaining review feedback (including Copilot comments) on the schema-driven settings.
Changes
Initialize()and abort startup, leaving vim_ahk effectively disabled. Values are now normalized with a per-key fallback to the default, exclusive-group conflicts are repaired deterministically, and a single warning dialog lists what was corrected. OK/Apply in the settings GUI keep the strict validation.WriteIni()deletes keys equal to the default, so future default updates (e.g. new applications in VimShiftEnter) reach users who have saved settings. The startup rewrite migrates configuration files written by older versions, which stored every setting. Import treats a missing key as the default value accordingly.WantTabis removed from the group editor so Tab moves focus.WinActive()queries on group names that were never created); unusedSetConfDefault()is removed.vim.ahkwith AutoHotkey v2/validateon pull requests and pushes to master (the existing build workflow runs only on tags).User-facing impact
Relates to #133.