Skip to content

Commit d9fc41a

Browse files
committed
report correct buttons with mouse button-event tracking mode
1 parent 7dd817a commit d9fc41a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/lTerm_unix.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -862,17 +862,17 @@ let rec parse_event ?(escape_time = 0.1) stream =
862862
| "[M" -> begin
863863
(* Mouse report *)
864864
let open LTerm_mouse in
865-
Lwt_stream.next stream >|= Char.code >>= fun mask ->
866-
Lwt_stream.next stream >|= Char.code >>= fun x ->
867-
Lwt_stream.next stream >|= Char.code >>= fun y ->
865+
Lwt_stream.next stream >|= Char.code >|= ((+)(-32)) >>= fun mask ->
866+
Lwt_stream.next stream >|= Char.code >|= ((+)(-32)) >>= fun x ->
867+
Lwt_stream.next stream >|= Char.code >|= ((+)(-32)) >>= fun y ->
868868
try
869869
if mask = 0b00100011 then raise Exit;
870870
return (LTerm_event.Mouse {
871871
control = mask land 0b00010000 <> 0;
872872
meta = mask land 0b00001000 <> 0;
873-
shift = false;
874-
row = y - 33;
875-
col = x - 33;
873+
shift = mask land 0b00000100 <> 0;
874+
row = y - 1;
875+
col = x - 1;
876876
button =
877877
(match mask land 0b11000111 with
878878
| 0b00000000 -> Button1

0 commit comments

Comments
 (0)