Page
Library
Module
Module type
Parameter
Class
Class type
Source
Inuit_cursorA cursor is very like an Inuit_region.t with a default set of flags. This is a convenient type to expose to higher-level code.
Since it is just a wrapper, you can refer to Inuit_region.t for the documentation of most functions.
The set of flags for buffers with the capability to mark areas as clickable and to receive clicks.
val null : _ cursorA dummy cursor that is always closed. Useful as a placeholder.
val text : 'flags cursor -> ?flags:'flags list -> string -> unittext cursor ?flags str append the text str at the right of cursor while moving it to right. If flags is not provided, default set of flags is applied.
val clear : 'flags cursor -> unitclear cursor erase the content of the region containing the cursor. New content can still be added, using text for instance.
val kill : 'flags cursor -> unitErase the content and close the cursor. No content can be added anymore.
sub cursor creates an empty sub-cursor at the right end of cursor. Clearing the sub-cursor will not affect other content, but clearing cursor will kill the sub-cursor.
val observe :
'flags cursor ->
('flags cursor ->
[ `Local | `Remote ] ->
'flags Inuit_base.patch ->
'flags list * (unit -> unit) option) ->
'flags cursorCreate a sub-cursor and associate an observer call-back. See Inuit_region.observer and Inuit_region.observe for more information.
val is_closed : 'flags cursor -> boolA cursor is closed if it has no observers, all changes will be ignored. This can happen when using kill, or clear on a parent cursor, and when the root socket is closed.
val region : 'flags cursor -> 'flags Inuit_region.tThe region affected by this cursor
A cursor is nothing but a region with a default set of flags. The following functions allow to manipulate this set.
Add a flag, mem_flag flag (add_flag flag c) = true.
Remove a flag, mem_flag flag (rem_flag flag c) = false.
val mem_flag : 'flags -> 'flags cursor -> boolCheck if a flag is in the set of flags of the cursor.
val get_flags : 'flags cursor -> 'flags listDirect access to the list of flags.
Replace the set of flags with a new one.
val get_indent : 'flags cursor -> intGet indentation level of cursor
Add the argument to indentation level, clamp negative values to 0. shift_ident t n = with_indent t (max 0 (get_indent t + n))
Create a sub-cursor that can be clicked. The call-back provided as argument is invoked during a click.
Append formatted text to the cursor
val link :
'flags clickable cursor ->
?flags:'flags list ->
('a, unit, string, ('flags cursor -> unit) -> unit) format4 ->
'aA mix of printf and clickable: append formatted text that can be clicked. The callback is provided last, for instance: link cursor "Click to visit %s" "https://github.com" (fun _ -> ...)
val cursor_of_region :
?flags:'flags list ->
?indent:int ->
'flags Inuit_region.t ->
'flags cursorMake a cursor from a region.
val make : unit -> 'flags cursor * 'flags Inuit_base.patch Inuit_base.socketInuit_region.make wrapper: return a root cursor and a pending socket. Socket must be connected prior to changing the cursor.