hide AnthyCommandConfig on other platforms - #23
Conversation
📝 WalkthroughWalkthroughThe configuration header corrects the misspelled Anthy command configuration type and wraps the command option in a platform-conditional visibility wrapper for Android, Apple, and Emscripten builds. ChangesAnthy configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/config.h`:
- Around line 678-681: Guard the action handlers in the relevant state/config
command setup, including uses of config().command->addWordCommand and
config().command->dictAdminCommand, so they no-op or are conditionally
unavailable on Android, Apple, and Emscripten, matching ConditionalHidden in the
command declaration and preventing launch_program from receiving empty commands.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| fcitx::ConditionalHidden < fcitx::isAndroid() || fcitx::isApple() || | ||
| fcitx::isEmscripten(), | ||
| fcitx::Option < AnthyCommandConfig >> | ||
| command{this, "Command", _("Command")};); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Downstream consumers unconditionally dereference config().command.
ConditionalHidden only affects UI visibility, so the option object should still exist on hidden platforms. However, src/state.cpp lines 1412-1422 unconditionally dereference config().command->addWordCommand and config().command->dictAdminCommand and launch them as programs. On Android/Apple/Emscripten these commands will likely be empty/default and launch_program on an empty string may fail or produce unexpected behavior.
Consider guarding those action handlers so they no-op (or are themselves conditionally hidden) on platforms where the command config is hidden.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/config.h` around lines 678 - 681, Guard the action handlers in the
relevant state/config command setup, including uses of
config().command->addWordCommand and config().command->dictAdminCommand, so they
no-op or are conditionally unavailable on Android, Apple, and Emscripten,
matching ConditionalHidden in the command declaration and preventing
launch_program from receiving empty commands.
Summary by CodeRabbit