summaryrefslogtreecommitdiffstats
path: root/otherlibs/labltk/browser/jg_box.ml
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/labltk/browser/jg_box.ml')
-rw-r--r--otherlibs/labltk/browser/jg_box.ml18
1 files changed, 10 insertions, 8 deletions
diff --git a/otherlibs/labltk/browser/jg_box.ml b/otherlibs/labltk/browser/jg_box.ml
index e7add1139..21a05829d 100644
--- a/otherlibs/labltk/browser/jg_box.ml
+++ b/otherlibs/labltk/browser/jg_box.ml
@@ -37,20 +37,22 @@ let add_completion ?:action ?:wait ?:nocase lb =
Jg_bind.enter_focus lb;
- bind lb events:[[], `KeyPress]
- action:(`Set([`Char], fun ev ->
+ bind lb events:[`KeyPress] fields:[`Char] action:
+ begin fun ev ->
(* consider only keys producing characters. The callback is called
even if you press Shift. *)
if ev.ev_Char <> "" then
- recenter lb index:(`Num (comp#add ev.ev_Char))));
+ recenter lb index:(`Num (comp#add ev.ev_Char))
+ end;
begin match action with
Some action ->
- bind lb events:[[], `KeyPressDetail "Return"]
- action:(`Set ([], fun _ -> action `Active));
- bind lb events:[[`Double], `ButtonPressDetail 1]
- action:(`Setbreakable ([`MouseY], fun ev ->
- action (Listbox.nearest lb y:ev.ev_MouseY); break ()))
+ bind lb events:[`KeyPressDetail "Return"]
+ action:(fun _ -> action `Active);
+ bind lb events:[`Modified([`Double], `ButtonPressDetail 1)]
+ breakable:true fields:[`MouseY]
+ action:(fun ev ->
+ action (Listbox.nearest lb y:ev.ev_MouseY); break ())
| None -> ()
end;