Skip to content

Commit

Permalink
fix: candidate box flash
Browse files Browse the repository at this point in the history
  • Loading branch information
amorphobia committed Nov 27, 2023
1 parent 7fd4c70 commit 1fa5b7c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Lib/RabbitCandidateBox.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CandidateBox extends Gui {
this.row_padding := dh1 - this.row_height
}

Build(context) {
Build(context, &width, &height) {
local has_selected := GetCompositionText(context.composition, &pre_selected, &selected, &post_selected)
local cands := context.menu.candidates
local lv_height := this.row_height * context.menu.num_candidates + this.row_padding
Expand Down Expand Up @@ -91,8 +91,10 @@ class CandidateBox extends Gui {

this.lv.Move(, , max_width, lv_height)
this.pre.Move(, , max_width)
this.lv.Redraw()

this.Show("Hide w" . (max_width + 6) . " h" . (this.preedit_height + lv_height + this.MarginY))
width := max_width + 6
height := this.preedit_height + lv_height + this.MarginY
}
}

Expand Down
5 changes: 2 additions & 3 deletions Rabbit.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#Requires AutoHotkey v2.0 32-bit
#Requires AutoHotkey v2.0
#SingleInstance Ignore

global TRAY_MENU_GRAYOUT := false
Expand Down Expand Up @@ -231,8 +231,7 @@ ProcessKey(key, mask, this_hotkey) {
if context := rime.get_context(session_id) {
if context.composition.length > 0 {
if GetCaretPos(&caret_x, &caret_y, &caret_w, &caret_h) {
box.Build(context)
box.GetPos(, , &box_width, &box_height)
box.Build(context, &box_width, &box_height)
new_x := caret_x + caret_w
new_y := caret_y + caret_h + 4

Expand Down
2 changes: 1 addition & 1 deletion RabbitDeployer.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#Requires AutoHotkey v2.0 32-bit
#Requires AutoHotkey v2.0

global TRAY_MENU_GRAYOUT := true

Expand Down

0 comments on commit 1fa5b7c

Please sign in to comment.