Repository navigation
Conversation
Port of the 0.17.4 zebra hilite feature onto current master, adapted to the DirectWrite-only painter: colors are overridden in the unified per-row drawing loop instead of the removed GDI channel. Adds style/zebra_hilite (bool, default off) plus a sibling node style/zebra_hilite_slots whose entries each carry a repeating 0/1 pattern (matched against the 0-based page row index, so "01" lights the 2nd/4th/6th... rows regardless of page size) and optional back_color/text_color/label_color/comment_color/border_color that fall back to the active color scheme's hilited colors when left transparent. The first slot matching a row wins; slots iterate in alphabetical name order (librime maps are std::map). The moving selection and hover highlight keep precedence over stripes. A slot without a usable pattern is skipped with a log line; patterns are filtered down to 0/1 so separators cannot stretch the period. The switch and the slot list live in separate config nodes because a scalar and a map cannot coexist under one rime config node: patches apply in document order and one write would either fail or wipe the other. The slot vector is serialized at the end of the UIStyle IPC stream, keeping the legacy prefix byte-compatible with older peers.
Three spots flagged by the lint job (clang-format 18).
The previous commit flipped ar & to ar& per clang-format 15 output, but the lint job uses clang-format 18 (Chromium style), which wants the spaced form here.
clang-format 18 (Chromium) wraps each parameter onto its own line here; the two-line wrap tripped the lint job at 547:28.
A zebra slot that leaves border_color at 0 kept the normal candidate border, while back/text/label/comment colors all inherit the scheme's hilited variants. Fall back to hilited_candidate_border_color when the scheme defines one, mirroring the back-color fallback; otherwise keep the normal candidate border.
takomitkm
marked this pull request as ready for review
November 22, 2026 21:13
takomitkm
marked this pull request as draft
November 22, 2026 21:15
Author
|
我觉得这个把ui搞得太复杂了,好像不太好,只是我觉得在我一直用数字选的情况下高亮永远都在第一个没什么用,所以弄了这个,好像还是有错,不想改了,感觉没用 |
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
Adds configurable "zebra hilite" stripes: besides the moving selection highlight, any set of candidate rows can stay permanently hilited, selected by repeating 0/1 patterns with per-slot colors.
Config (user
weasel.custom.yaml):Semantics:
menu/page_size.std::map), soaoutrankszwhen patterns overlap."0,1"are filtered out so they cannot stretch the period.Why a sibling node for the slots
style/zebra_hilite(a scalar) and the slot list cannot live under one config node: rime patches apply scalar and map writes to the same node in document order, and one write would either fail the patch or wipe the other (a bool over a map, or a map over a bool). Keeping them as siblings makes the two independent and order-insensitive.Implementation notes
include/WeaselIPCData.h:UIStylegainszebra_hiliteplus astd::vector<ZebraSlot>(pattern + five optional colors). The slot vector is serialized at the end of the UIStyle IPC stream, keeping the legacy prefix byte-compatible with older peers: an old server ignores the trailing bytes; a new client against an old server only occurs in a half-install window and fails deserialization cleanly there.RimeWithWeasel/RimeWithWeasel.cpp: slots are enumerated viaconfig_begin_map/config_nextinLoadWeaselUIStyle; the slot list is cleared only when the config actually definesstyle/zebra_hilite_slots, so a schema without zebra settings keeps inheriting the base slot table (matching how other style keys work).WeaselUI/WeaselPanel.cpp: in_DrawCandidates, after the per-row colors are picked, the first matching slot overrides them before drawing. Works with both the GDI and DirectWrite paths of the 0.17.4 painter and with the DirectWrite-only painter on current master (this branch is based on master).Before submitting
Notes for reviewers
WeaselDeployer's style preview (UIStyleSettings::LoadPreviewStyle) picks the feature up automatically throughLoadWeaselUIStyle; no deployer-side changes were needed.