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/keycodes.h"
#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/os/input.h"
#include "nvim/state.h"
#include "nvim/ui.h"
#include "nvim/vim.h"


#define READ_BUFFER_SIZE   0xfff
#define BREAKCHECK_SKIP   1000


enum  InbufPollResult { kInputNone, kInputAvail, kInputEof }


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)
void line_breakcheck (void)
void fast_breakcheck (void)
 Like line_breakcheck() but check 10 times less often. More...
void veryfast_breakcheck (void)
 Like line_breakcheck() but check 100 times less often. More...
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


#define BREAKCHECK_SKIP   1000




#define READ_BUFFER_SIZE   0xfff

Enumeration Type Documentation

◆ InbufPollResult


Function Documentation

◆ fast_breakcheck()

void fast_breakcheck ( void  )

Like line_breakcheck() but check 10 times less often.

◆ input_available()

bool input_available ( void  )

◆ input_blocking()

bool input_blocking ( void  )
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  )

◆ line_breakcheck()

void line_breakcheck ( void  )

Check for CTRL-C pressed, but only once in a while.

Should be used instead of os_breakcheck() for functions that check for each line in the file. Calling os_breakcheck() each time takes too much time, because it will use system calls to check for input.

◆ 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.

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

◆ veryfast_breakcheck()

void veryfast_breakcheck ( void  )

Like line_breakcheck() but check 100 times less often.