enter and repeats

This commit is contained in:
cqc
2024-05-09 22:18:55 -05:00
parent db32a0e15e
commit 9641927e8a

27
ogui.ml
View File

@ -961,19 +961,25 @@ module TextEdit = struct
|> adds
[
[ Key (Press, F, [ Control ]) ];
[ Key (Repeat, F, [ Control ]) ];
[ Key (Press, Right, []) ];
[ Key (Repeat, Right, []) ];
]
[ Custom (fun () -> cursor_move t 1) ]
|> adds
[
[ Key (Press, B, [ Control ]) ];
[ Key (Repeat, B, [ Control ]) ];
[ Key (Press, Left, []) ];
[ Key (Repeat, Left, []) ];
]
[ Custom (fun () -> cursor_move t (-1)) ]
|> adds
[
[ Key (Press, N, [ Control ]) ];
[ Key (Repeat, N, [ Control ]) ];
[ Key (Press, Down, []) ];
[ Key (Repeat, Down, []) ];
]
[
Custom
@ -1002,7 +1008,10 @@ module TextEdit = struct
]
|> adds
[
[ Key (Press, P, [ Control ]) ]; [ Key (Press, Up, []) ];
[ Key (Press, P, [ Control ]) ];
[ Key (Repeat, P, [ Control ]) ];
[ Key (Press, Up, []) ];
[ Key (Repeat, Up, []) ];
]
[
Custom
@ -1065,7 +1074,10 @@ module TextEdit = struct
t.cursor.index)));
]
|> adds
[ [ Key (Press, Backspace, []) ] ]
[
[ Key (Press, Backspace, []) ];
[ Key (Repeat, Backspace, []) ];
]
[
Custom
(fun () ->
@ -1075,6 +1087,17 @@ module TextEdit = struct
t.text <- text;
cursor_move t (-1))
else Lwt.return_unit);
]
|> adds
[ [ Key (Press, Enter, []) ]; [ Key (Repeat, Enter, []) ] ]
[
Custom
(fun () ->
TextBuffer.insert_uchar t.text t.cursor.index
(Uchar.of_char '\n')
>>= fun text ->
t.text <- text;
cursor_move t 1);
];
(* WARN XXX TKTK TODO this is probably "breaking" the lwt context and being used in other calls to Lwt_main.run *)