Macros | Enumerations | Functions
input.c File Reference
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <uv.h>
#include "nvim/api/private/defs.h"
#include "nvim/ascii.h"
#include "nvim/event/loop.h"
#include "nvim/event/rstream.h"
#include "nvim/ex_cmds2.h"
#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/keymap.h"
#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/misc1.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/os/input.h"
#include "nvim/state.h"
#include "nvim/ui.h"
#include "nvim/vim.h"

Macros

#define READ_BUFFER_SIZE   0xfff
 
#define INPUT_BUFFER_SIZE   (READ_BUFFER_SIZE * 4)
 

Enumerations

enum  InbufPollResult { kInputNone, kInputAvail, kInputEof }
 

Functions

void input_init (void)
 
void input_global_fd_init (int fd)
 
int input_global_fd (void)
 Global TTY (or pipe for "-es") input stream, before UI starts. More...
 
void input_start (int fd)
 
void input_stop (void)
 
int os_inchar (uint8_t *buf, int maxlen, int ms, int tb_change_cnt, MultiQueue *events)
 
bool os_char_avail (void)
 
void os_breakcheck (void)
 
bool os_isatty (int fd)
 
size_t input_enqueue (String keys)
 
size_t input_enqueue_mouse (int code, uint8_t modifier, int grid, int row, int col)
 
bool input_blocking (void)
 
void input_done (void)
 
bool input_available (void)
 

Macro Definition Documentation

◆ INPUT_BUFFER_SIZE

#define INPUT_BUFFER_SIZE   (READ_BUFFER_SIZE * 4)

◆ READ_BUFFER_SIZE

#define READ_BUFFER_SIZE   0xfff

Enumeration Type Documentation

◆ InbufPollResult

Enumerator
kInputNone 
kInputAvail 
kInputEof 

Function Documentation

◆ input_available()

bool input_available ( void  )

◆ input_blocking()

bool input_blocking ( void  )
Returns
true if the main loop is blocked and waiting for input.

◆ input_done()

void input_done ( void  )

◆ input_enqueue()

size_t input_enqueue ( String  keys)

◆ input_enqueue_mouse()

size_t input_enqueue_mouse ( int  code,
uint8_t  modifier,
int  grid,
int  row,
int  col 
)

◆ input_global_fd()

int input_global_fd ( void  )

Global TTY (or pipe for "-es") input stream, before UI starts.

◆ input_global_fd_init()

void input_global_fd_init ( int  fd)

◆ input_init()

void input_init ( void  )

◆ input_start()

void input_start ( int  fd)

◆ input_stop()

void input_stop ( void  )

◆ os_breakcheck()

void os_breakcheck ( void  )

Poll for fast events. got_int will be set to true if CTRL-C was typed.

This invokes a full libuv loop iteration which can be quite costly. Prefer line_breakcheck() if called in a busy inner loop.

Caller must at least check got_int before calling this function again. checking for other low-level input state like input_available() might also be relevant (i e to throttle idle processing when user input is available)

◆ os_char_avail()

bool os_char_avail ( void  )

◆ os_inchar()

int os_inchar ( uint8_t *  buf,
int  maxlen,
int  ms,
int  tb_change_cnt,
MultiQueue events 
)

Low level input function

wait until either the input buffer is non-empty or , if events is not NULL until events is non-empty.

◆ os_isatty()

bool os_isatty ( int  fd)

Test whether a file descriptor refers to a terminal.

Parameters
fdFile descriptor.
Returns
true if file descriptor refers to a terminal.