Macros | Functions | Variables
getchar.c File Reference
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/getchar.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/func_attr.h"
#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/keymap.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/event/loop.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/fileio.h"
#include "nvim/api/private/handle.h"

Macros

#define MINIMAL_SIZE   20 /* minimal size for b_str */
 
#define MAP_HASH(mode, c1)
 
#define RM_YES   0 /* tb_noremap: remap */
 
#define RM_NONE   1 /* tb_noremap: don't remap */
 
#define RM_SCRIPT   2 /* tb_noremap: remap local script mappings */
 
#define RM_ABBR   4 /* tb_noremap: don't remap, do abbrev. */
 
#define TYPELEN_INIT   (5 * (MAXMAPLEN + 3))
 
#define DUM_LEN   MAXMAPLEN * 3 + 3
 
#define MAPMODE(mode, modechars, chr, modeflags)
 

Functions

void free_buff (buffheader_T *buf)
 
char_uget_recorded (void)
 
char_uget_inserted (void)
 
int stuff_empty (void)
 
int readbuf1_empty (void)
 
void typeahead_noflush (int c)
 
void flush_buffers (flush_buffers_T flush_typeahead)
 
void ResetRedobuff (void)
 
void CancelRedo (void)
 
void saveRedobuff (save_redo_T *save_redo)
 
void restoreRedobuff (save_redo_T *save_redo)
 
void AppendToRedobuff (const char *s)
 
void AppendToRedobuffLit (char_u *str, int len)
 
void AppendCharToRedobuff (int c)
 
void AppendNumberToRedobuff (long n)
 
void stuffReadbuff (const char *s)
 
void stuffRedoReadbuff (const char *s)
 
void stuffReadbuffLen (const char *s, long len)
 
void stuffReadbuffSpec (const char *s)
 
void stuffcharReadbuff (int c)
 
void stuffnumReadbuff (long n)
 
int start_redo (long count, bool old_redo)
 
int start_redo_ins (void)
 
void stop_redo_ins (void)
 
int ins_typebuf (char_u *str, int noremap, int offset, int nottyped, bool silent)
 
void ins_char_typebuf (int c)
 
int typebuf_changed (int tb_change_cnt)
 
int typebuf_typed (void)
 
int typebuf_maplen (void)
 
void del_typebuf (int len, int offset)
 
void may_sync_undo (void)
 
void alloc_typebuf (void)
 
void free_typebuf (void)
 
void save_typebuf (void)
 
void save_typeahead (tasave_T *tp)
 
void restore_typeahead (tasave_T *tp)
 
void openscript (char_u *name, int directly)
 
int using_script (void)
 
void before_blocking (void)
 
int vgetc (void)
 
int safe_vgetc (void)
 
int plain_vgetc (void)
 
int vpeekc (void)
 
int vpeekc_any (void)
 
int char_avail (void)
 
void vungetc (int c)
 
int inchar (char_u *buf, int maxlen, long wait_time)
 
int fix_input_buffer (char_u *buf, int len)
 
int do_map (int maptype, char_u *arg, int mode, int abbrev)
 
int get_map_mode (char_u **cmdp, int forceit)
 
void map_clear_mode (char_u *cmdp, char_u *arg, int forceit, int abbr)
 
void map_clear_int (buf_T *buf, int mode, int local, int abbr)
 
char * map_mode_to_chars (int mode) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET
 
bool map_to_exists (const char *const str, const char *const modechars, const bool abbr) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE
 
int map_to_exists_mode (const char *const rhs, const int mode, const bool abbr)
 
char_uset_context_in_map_cmd (expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx)
 
int ExpandMappings (regmatch_T *regmatch, int *num_file, char_u ***file)
 
int check_abbr (int c, char_u *ptr, int col, int mincol)
 
char_uvim_strsave_escape_csi (char_u *p)
 
void vim_unescape_csi (char_u *p)
 
int makemap (FILE *fd, buf_T *buf)
 
int put_escstr (FILE *fd, char_u *strstart, int what)
 
char_ucheck_map (char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr)
 
void add_map (char_u *map, int mode)
 
mapblock_Tget_maphash (int index, buf_T *buf) FUNC_ATTR_PURE
 
char_ugetcmdkeycmd (int promptc, void *cookie, int indent)
 Get command argument for <Cmd> key. More...
 

Variables

FileDescriptorscriptin [NSCRIPT] = { NULL }
 Streams to read script from. More...
 

Macro Definition Documentation

#define DUM_LEN   MAXMAPLEN * 3 + 3
#define MAP_HASH (   mode,
  c1 
)
Value:
(((mode) & \
OP_PENDING + TERM_FOCUS)) ? (c1) : ((c1) ^ 0x80))
#define VISUAL
Definition: vim.h:50
#define NORMAL
Definition: vim.h:49
#define SELECTMODE
Definition: vim.h:72
#define TERM_FOCUS
Definition: vim.h:73
#define OP_PENDING
Definition: vim.h:51
#define MAPMODE (   mode,
  modechars,
  chr,
  modeflags 
)
Value:
do { \
if (strchr(modechars, chr) != NULL) { \
mode |= modeflags; \
} \
} while (0)
if(len)
Definition: encode.c:226
return NULL
Definition: eval.c:22200
#define MINIMAL_SIZE   20 /* minimal size for b_str */
#define RM_ABBR   4 /* tb_noremap: don't remap, do abbrev. */
#define RM_NONE   1 /* tb_noremap: don't remap */
#define RM_SCRIPT   2 /* tb_noremap: remap local script mappings */
#define RM_YES   0 /* tb_noremap: remap */
#define TYPELEN_INIT   (5 * (MAXMAPLEN + 3))

Function Documentation

void add_map ( char_u map,
int  mode 
)
void alloc_typebuf ( void  )
void AppendCharToRedobuff ( int  c)
void AppendNumberToRedobuff ( long  n)
void AppendToRedobuff ( const char *  s)
void AppendToRedobuffLit ( char_u str,
int  len 
)
void before_blocking ( void  )

This function is called just before doing a blocking wait. Thus after waiting 'updatetime' for a character to arrive.

void CancelRedo ( void  )
int char_avail ( void  )
int check_abbr ( int  c,
char_u ptr,
int  col,
int  mincol 
)
char_u* check_map ( char_u keys,
int  mode,
int  exact,
int  ign_mod,
int  abbr,
mapblock_T **  mp_ptr,
int *  local_ptr 
)
void del_typebuf ( int  len,
int  offset 
)
int do_map ( int  maptype,
char_u arg,
int  mode,
int  abbrev 
)
int ExpandMappings ( regmatch_T regmatch,
int *  num_file,
char_u ***  file 
)
int fix_input_buffer ( char_u buf,
int  len 
)
void flush_buffers ( flush_buffers_T  flush_typeahead)
void free_buff ( buffheader_T buf)
void free_typebuf ( void  )
char_u* get_inserted ( void  )
int get_map_mode ( char_u **  cmdp,
int  forceit 
)
mapblock_T* get_maphash ( int  index,
buf_T buf 
)

Retrieve the mapblock at the index either globally or for a certain buffer

Parameters
indexThe index in the maphash[]
bufThe buffer to get the maphash from. NULL for global
char_u* get_recorded ( void  )
char_u* getcmdkeycmd ( int  promptc,
void *  cookie,
int  indent 
)

Get command argument for <Cmd> key.

int inchar ( char_u buf,
int  maxlen,
long  wait_time 
)
void ins_char_typebuf ( int  c)
int ins_typebuf ( char_u str,
int  noremap,
int  offset,
int  nottyped,
bool  silent 
)
int makemap ( FILE *  fd,
buf_T buf 
)
void map_clear_int ( buf_T buf,
int  mode,
int  local,
int  abbr 
)
void map_clear_mode ( char_u cmdp,
char_u arg,
int  forceit,
int  abbr 
)
char* map_mode_to_chars ( int  mode)

Return characters to represent the map mode in an allocated string

Returns
[allocated] NUL-terminated string with characters.
bool map_to_exists ( const char *const  str,
const char *const  modechars,
const bool  abbr 
)

Check if a map exists that has given string in the rhs

Also checks mappings local to the current buffer.

Parameters
[in]strString which mapping must have in the rhs. Termcap codes are recognized in this argument.
[in]modecharsMode(s) in which mappings are checked.
[in]abbrtrue if checking abbreviations in place of mappings.
Returns
true if there is at least one mapping with given parameters.
int map_to_exists_mode ( const char *const  rhs,
const int  mode,
const bool  abbr 
)

Check if a map exists that has given string in the rhs

Also checks mappings local to the current buffer.

Parameters
[in]rhsString which mapping must have in the rhs. Termcap codes are recognized in this argument.
[in]modeMode(s) in which mappings are checked.
[in]abbrtrue if checking abbreviations in place of mappings.
Returns
true if there is at least one mapping with given parameters.
void may_sync_undo ( void  )
void openscript ( char_u name,
int  directly 
)
int plain_vgetc ( void  )
int put_escstr ( FILE *  fd,
char_u strstart,
int  what 
)
int readbuf1_empty ( void  )
void ResetRedobuff ( void  )
void restore_typeahead ( tasave_T tp)
void restoreRedobuff ( save_redo_T save_redo)

Restore redobuff and old_redobuff from save_redobuff and save_old_redobuff. Used after executing autocommands and user functions.

int safe_vgetc ( void  )
void save_typeahead ( tasave_T tp)
void save_typebuf ( void  )
void saveRedobuff ( save_redo_T save_redo)

Save redobuff and old_redobuff to save_redobuff and save_old_redobuff. Used before executing autocommands and user functions.

char_u* set_context_in_map_cmd ( expand_T xp,
char_u cmd,
char_u arg,
int  forceit,
int  isabbrev,
int  isunmap,
cmdidx_T  cmdidx 
)
int start_redo ( long  count,
bool  old_redo 
)
int start_redo_ins ( void  )
void stop_redo_ins ( void  )
int stuff_empty ( void  )
void stuffcharReadbuff ( int  c)
void stuffnumReadbuff ( long  n)
void stuffReadbuff ( const char *  s)
void stuffReadbuffLen ( const char *  s,
long  len 
)
void stuffReadbuffSpec ( const char *  s)
void stuffRedoReadbuff ( const char *  s)

Append string "s" to the redo stuff buffer.

Remarks
CSI and K_SPECIAL must already have been escaped.
void typeahead_noflush ( int  c)
int typebuf_changed ( int  tb_change_cnt)
int typebuf_maplen ( void  )
int typebuf_typed ( void  )
int using_script ( void  )
int vgetc ( void  )
char_u* vim_strsave_escape_csi ( char_u p)
void vim_unescape_csi ( char_u p)
int vpeekc ( void  )
int vpeekc_any ( void  )
void vungetc ( int  c)

Variable Documentation

FileDescriptor* scriptin[NSCRIPT] = { NULL }

Streams to read script from.