File: json_ui.asciidoc

package info (click to toggle)
kakoune 0~2016.12.20.1.3a6167ae-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,100 kB
  • ctags: 3,635
  • sloc: cpp: 22,465; sh: 295; python: 136; makefile: 123; ruby: 59
file content (47 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download
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
Json-Rpc user interface
=======================

Kakoune user interfaces can be implemented through the json-rpc 2.0 protocol.

By launching kakoune in client mode with the `-ui json` option, the launched
client will write newline separated json-rpc requests on stdout and read
json-rpc requests on stdin.  Errors will be reported on stderr (not in
json format).

Kakoune requests are always using positional parameters, never named, and
Kakoune won't be able to parse named parameters in requests.

Here are the data structures used:

* Color: a string, either a named color, or #rrggbb
* Attribute: one of {exclusive, underline, reverse, blink, bold, dim, italic}
* Face { Color fg; Color bg; Array<Attribute> attributes; }
* Atom { Face face; String contents; }
* Line : Array of Atom
* Coord { int line; int column }

Here are the requests that can be written by the json ui on stdout:

* draw(Array<Line> lines, Face default_face, Face padding_face)
* draw_status(Line status_line, Line mode_line,
              Face default_face)
* menu_show(Array<Line> items, Coord anchor, Face fg, Face bg,
            String style)
  style can be:
  - prompt: display the menu as a prompt menu (anchor is ignored)
  - inline: display the menu next to (above or below) the anchor coordinate
* menu_select(int selected)
* menu_hide()
* info_show(String title, String content, Coord anchor, Face face, String style)
  style can be:
  - prompt: display the info as a prompt info (anchor is ignored)
  - inline: display the info next to (above or below) the anchor coordinate
  - inlineAbove: display the info next to (above) the anchor coordinate
  - inlineBelow: display the info next to (below) the anchor coordinate
  - menuDoc: display the info next to the menu, as a documentation for it
* info_hide()

The requests that the json ui can interpret on stdin are:

* keys(String key1, String key2...): keystrokes
* resize(int rows, int columns): notify ui resize