iPXE
|
Editable strings. More...
Go to the source code of this file.
Data Structures | |
struct | edit_string |
An editable string. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static __nonnull void | init_editstring (struct edit_string *string, char **buf) |
Initialise editable string. More... | |
__attribute__ ((nonnull(1))) int replace_string(struct edit_string *string | |
__nonnull int | edit_string (struct edit_string *string, int key) |
Edit editable string. More... | |
Variables | |
const char * | replacement |
Editable strings.
Definition in file editstring.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise editable string.
string | Editable string |
buf | Dynamically allocated string buffer |
The buf
parameter must be the address of a caller-provided pointer to a NUL-terminated string allocated using malloc() (or equivalent, such as strdup()). Any edits made to the string will realloc() the string buffer as needed.
The caller may choose leave the initial string buffer pointer as NULL
, in which case it will be allocated upon the first attempt to insert a character into the buffer. If the caller does this, then it must be prepared to find the pointer still NULL
after editing, since the user may never attempt to insert any characters.
Definition at line 46 of file editstring.h.
Referenced by editstring_okx(), init_editbox(), and readline_history().
__attribute__ | ( | (nonnull(1)) | ) |
__nonnull int edit_string | ( | struct edit_string * | string, |
int | key | ||
) |
Edit editable string.
string | Editable string |
key | Key pressed by user |
key | Key returned to application, zero, or negative error |
Handles keypresses and updates the content of the editable string. Basic line editing facilities (delete/insert/cursor) are supported. If edit_string() understands and uses the keypress it will return zero, otherwise it will return the original key.
The string's edit history will be updated to allow the caller to efficiently bring the display into sync with the string content.
This function does not itself update the display in any way.
Errors may safely be ignored if it is deemed that subsequently failing to update the display will provide sufficient feedback to the user.
Definition at line 255 of file editstring.c.
References backspace(), CTRL_A, CTRL_B, CTRL_D, CTRL_E, CTRL_F, CTRL_K, CTRL_U, CTRL_W, delete_character(), insert_character(), key, KEY_BACKSPACE, KEY_DC, KEY_END, KEY_HOME, KEY_LEFT, KEY_RIGHT, kill_eol(), kill_sol(), kill_word(), len, retval, string, and strlen().
Referenced by edit_editbox(), and readline_history().
const char* replacement |
Definition at line 53 of file editstring.h.
Referenced by image_exec(), image_replace(), myri10ge_net_poll(), and replace_string().