Functions
input.c File Reference
#include <inttypes.h>
#include <stdbool.h>
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/input.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/mouse.h"
#include "nvim/os/input.h"
#include "nvim/ui.h"
#include "nvim/vim.h"

Functions

int ask_yesno (const char *const str, const bool direct)
 
int get_keystroke (MultiQueue *events)
 
int get_number (int colon, int *mouse_used)
 
int prompt_for_number (int *mouse_used)
 

Function Documentation

◆ ask_yesno()

int ask_yesno ( const char *const  str,
const bool  direct 
)

Ask for a reply from the user, 'y' or 'n'

No other characters are accepted, the message is repeated until a valid reply is entered or <C-c> is hit.

Parameters
[in]strPrompt: question to ask user. Is always followed by " (y/n)?".
[in]directDetermines what function to use to get user input. If true then ui_inchar() will be used, otherwise vgetc(). I.e. when direct is true then characters are obtained directly from the user without buffers involved.
Returns
'y' or 'n'. Last is also what will be returned in case of interrupt.

◆ get_keystroke()

int get_keystroke ( MultiQueue events)

Get a key stroke directly from the user.

Ignores mouse clicks and scrollbar events, except a click for the left button (used at the more prompt). Doesn't use vgetc(), because it syncs undo and eats mapped characters. Disadvantage: typeahead is ignored. Translates the interrupt character for unix to ESC.

◆ get_number()

int get_number ( int  colon,
int *  mouse_used 
)

Get a number from the user. When "mouse_used" is not NULL allow using the mouse.

Parameters
colonallow colon to abort

◆ prompt_for_number()

int prompt_for_number ( int *  mouse_used)

Ask the user to enter a number.

When "mouse_used" is not NULL allow using the mouse and in that case return the line number.