nvim_oxi_api/opts/
open_term.rs

1use crate::Buffer;
2use crate::ToFunction;
3
4/// Arguments passed to the callback registered to
5/// [`on_input`](OpenTermOptsBuilder::on_input). The `(a, b, c, d)` tuple
6/// represents:
7///
8/// - `a`: the string literal `"input"`;
9/// - `b`: channel id;
10/// - `c`: the [`Buffer`] associated to the terminal instance;
11/// - `d`: data input.
12pub type OnInputArgs = (
13    String,        // the string literal `"input"`
14    u32,           // channel_id
15    Buffer,        // buffer
16    types::String, // data input
17);
18
19/// Options passed to [`open_term()`](crate::open_term).
20#[derive(Clone, Debug, Default, macros::OptsBuilder)]
21#[repr(C)]
22pub struct OpenTermOpts {
23    #[builder(mask)]
24    mask: u64,
25
26    #[builder(
27        generics = "F: ToFunction<OnInputArgs, ()>",
28        argtype = "F",
29        inline = "{0}.into_luaref()"
30    )]
31    /// Callback invoked on data input (like keypresses in terminal mode).
32    on_input: types::LuaRef,
33}