Skip to content

Commit

Permalink
fix: cand box out of screen
Browse files Browse the repository at this point in the history
still buggy if the box go out of screen after typing some words
  • Loading branch information
amorphobia committed Nov 17, 2023
1 parent dff27f1 commit b05811f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Rabbit.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,21 @@ ProcessKey(key, mask, this_hotkey) {
max_width := 150

if caret {
workspace_width := SysGet(16) ; SM_CXFULLSCREEN
workspace_height := SysGet(17) ; SM_CYFULLSCREEN
box["Preedit"].Value := preedit_text
box["Candidates"].Value := menu_text
box["Preedit"].Move(, , max_width)
box["Candidates"].Move(, , max_width, height * candidate_text_array.Length)
box.Show("Hide")
box.Show("AutoSize NA x" . (caret_x + caret_w) . " y" . (caret_y + caret_h + 4))
box.GetPos(, , &box_width, &box_height)
new_x := caret_x + caret_w
new_y := caret_y + caret_h + 4
if new_x + box_width > workspace_width
new_x := workspace_width - box_width
if new_y + box_height > workspace_height
new_y := caret_y - 4 - box_height
box.Show("AutoSize NA x" . new_x . " y" . new_y)
WinSetAlwaysOnTop(1, box)
} else {
ToolTip(preedit_text . "`r`n" . menu_text)
Expand Down

0 comments on commit b05811f

Please sign in to comment.