package miaou-core

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file tui_page.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(******************************************************************************)
(*                                                                            *)
(* SPDX-License-Identifier: MIT                                               *)
(* Copyright (c) 2026 Nomadic Labs <contact@nomadic-labs.com>                 *)
(*                                                                            *)
(******************************************************************************)

[@@@warning "-32-34-37-69"]

(** Display-only key hint for help footer. *)
type key_hint = {key : string; help : string}

(** Legacy key binding type. Deprecated - use [key_hint] for display
    and [on_key] for handling. *)
type 'state key_binding_desc = {
  key : string;
  action : 'state Navigation.t -> 'state Navigation.t;
  help : string;
  display_only : bool;
}

type 'state key_binding = 'state key_binding_desc

module type PAGE_SIG = sig
  type state

  type msg

  type key_binding = state key_binding_desc

  type pstate = state Navigation.t

  val init : unit -> pstate

  val update : pstate -> msg -> pstate

  val view : pstate -> focus:bool -> size:LTerm_geom.size -> string

  (* New key handling API *)
  val on_key :
    pstate ->
    Keys.t ->
    size:LTerm_geom.size ->
    pstate * Miaou_interfaces.Key_event.result

  val on_modal_key :
    pstate ->
    Keys.t ->
    size:LTerm_geom.size ->
    pstate * Miaou_interfaces.Key_event.result

  val key_hints : pstate -> key_hint list

  (* Legacy key handling API (deprecated) *)
  val handle_key : pstate -> string -> size:LTerm_geom.size -> pstate

  val handle_modal_key : pstate -> string -> size:LTerm_geom.size -> pstate

  val keymap : pstate -> key_binding list

  (* Lifecycle *)
  val refresh : pstate -> pstate

  val has_modal : pstate -> bool

  (* Legacy methods (deprecated) *)
  val move : pstate -> int -> pstate

  val service_select : pstate -> int -> pstate

  val service_cycle : pstate -> int -> pstate

  val back : pstate -> pstate

  val handled_keys : unit -> Keys.t list
end