Skip to content

Commit 7eecd28

Browse files
committed
fix: preedit box cannot resize
1 parent 486f850 commit 7eecd28

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Lib/RabbitCandidateBox.ahk

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ class CandidateBox extends Gui {
2929

3030
__New() {
3131
super.__New(, , this)
32+
local back_color_val := UIStyle.back_color & 0xffffff
33+
local text_color := Format("c{:x}", UIStyle.text_color & 0xffffff)
34+
local font_point := Format("S{:d}", UIStyle.font_point)
35+
local font_face := UIStyle.font_face
3236
this.Opt("-DPIScale -Caption +Owner AlwaysOnTop " . WS_EX_NOACTIVATE)
3337
this.MarginX := 3
3438
this.MarginY := 3
35-
this.BackColor := 0x191919
36-
this.SetFont("S12 cWhite", "Microsoft YaHei UI")
39+
this.BackColor := back_color_val
40+
this.SetFont(Format("{} {}", font_point, text_color), font_face)
3741

3842
this.pre := this.AddText(, "p")
3943
this.pre.GetPos(, , , &h)
@@ -56,7 +60,7 @@ class CandidateBox extends Gui {
5660
local font_point := Format("S{:d}", UIStyle.font_point)
5761
local font_face := UIStyle.font_face
5862
this.BackColor := back_color_val
59-
this.pre.SetFont(Format("{} {}", font_point, text_color), font_face)
63+
this.SetFont(Format("{} {}", font_point, text_color), font_face)
6064
this.pre.SetFont(Format("{} {}", font_point, text_color), font_face)
6165
this.lv.Opt(Format("{} Background0x{:x}", text_color, back_color_val))
6266

Rabbit.ahk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
global IN_MAINTENANCE := false
3535
global session_id := 0
36-
global box := CandidateBox()
3736
global mutex := RabbitMutex()
3837
global last_is_hide := false
3938

@@ -43,6 +42,7 @@ RabbitMain(A_Args)
4342
; args[2]: deployer result
4443
; args[3]: keyboard layout
4544
RabbitMain(args) {
45+
global box
4646
if args.Length >= 3
4747
layout := Number(args[3])
4848
if !IsSet(layout) || layout == 0 {
@@ -100,6 +100,7 @@ RabbitMain(args) {
100100

101101
CleanOldLogs()
102102
RabbitConfig.load()
103+
box := CandidateBox()
103104
RegisterHotKeys()
104105
UpdateStateLabels()
105106
if status := rime.get_status(session_id) {

schemas/rabbit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fix_candidate_box: false
2626

2727
style:
2828
color_scheme: aqua
29-
font_point: 12 # FIXME: preedit box cannot resize
29+
font_point: 12
3030

3131
# Copied from weasel.yaml
3232
# Current supported fields

0 commit comments

Comments
 (0)