Inuit_cursorSourceA 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.
text 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.
clear cursor erase the content of the region containing the cursor. New content can still be added, using text for instance.
Erase 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.
A 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.
The 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.
Check if a flag is in the set of flags of the cursor.
Replace the set of flags with a new one.
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.
Inuit_region.make wrapper: return a root cursor and a pending socket. Socket must be connected prior to changing the cursor.