Kitty Graphics Protocol in OCaml
terminal
graphics
ocaml
1(** Cursor Movement Behavior
2
3 Controls cursor position after displaying an image.
4
5 {2 Protocol Details}
6
7 Cursor movement is specified via the [C] key in the control data:
8 - [C=0] or no [C] key: move cursor after display (default)
9 - [C=1]: keep cursor in place (static)
10
11 This key was added in Kitty 0.20.0.
12
13 {2 Default Behavior}
14
15 By default ([{`Move}]), after displaying an image the cursor advances:
16 - Right by the number of columns the image occupies
17 - Down by the number of rows the image occupies
18
19 This matches how the cursor moves after printing text, allowing images
20 to flow naturally with text content.
21
22 {2 Static Cursor}
23
24 With [{`Static}], the cursor remains at its original position. This is
25 useful when:
26 - Overlaying images on existing content
27 - Positioning multiple images relative to the same starting point
28 - Implementing custom cursor management
29
30 {2 Relative Placements}
31
32 Note: When using relative placements (positioning images relative to
33 other placements), the cursor never moves regardless of this setting. *)
34
35type t = [ `Move | `Static ]
36(** Cursor movement behavior.
37
38 - [`Move] - Advance cursor past the displayed image (default).
39 Cursor moves right by the number of columns and down by the
40 number of rows occupied by the image.
41 - [`Static] - Keep cursor at its original position. The image
42 is displayed but cursor position is unchanged. *)
43
44val to_int : t -> int
45(** Convert to protocol integer.
46
47 Returns 0 for [`Move] or 1 for [`Static].
48 These values are used in the [C=] control data key. *)