feat: add fail-safe Markdown punctuation mode - #131
Conversation
runjuu
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I found several issues that need to be addressed before merging:
-
Markdown Mode applies its ANSI-key map to every
isCJKVRsource, but that predicate includes Russian. With the standard Russian layout, ordinary letters such asё,х,ъ,Б, andЮare globally replaced. Please restrict the mode to supported Chinese input sources or resolve the actual character produced by the active layout. -
The 500 ms input-source cache is not invalidated when TIS changes sources. Switching quickly from Chinese to English can make Shift+comma insert
《》instead of<; the reverse transition can miss a Markdown replacement. Please invalidate the cache on source changes or avoid it for non-identity Markdown substitutions. -
When permissions are missing,
IndicatorVMimmediately resetsisMarkdownModeEnabledto false, while the permission buttons are only visible when that same setting is true. On a fresh permission state the toggle snaps off before the actionable controls render. Please provide a permission-request flow that remains accessible after rollback. -
The new timeout and tap-disabled shutdown path is mode-blind. A timeout while only the existing per-app
.appEnglishmode is active disables that service and displays a Markdown safety warning. Please make the callback mode-aware and keep Markdown-specific state changes limited to Markdown failures. -
isMarkdownModeEnabledis missing fromSettingsBackupPreferences, so settings export and scriptable restore do not preserve the new option. Please add the optional field to declaration, export, and apply paths, with a round-trip test.
The README should also retain the existing per-app Force English Punctuation documentation instead of describing the upstream project as a customized build.
I verified commit 950380a: Debug and Release builds, Xcode analysis, localization validation, and all 48 existing tests pass. The issues above are runtime and state-transition cases not covered by the current tests.
Summary
Adds an opt-in, system-wide Markdown Mode for CJK input sources.
When enabled, it replaces:
·) with a backtick¥with$》with>【】with[]《inserts《》Other Chinese prose punctuation, including quotes and parentheses, remains unchanged.
Safety
Because punctuation replacement uses a keyboard event tap, this change is fail-open:
The existing per-app “Force English Punctuation” behavior is preserved.
Testing
xcodebuild -scheme "Input Source Pro" -configuration Debug test