Get a key from the user. More...
#include "config.h"#include <ctype.h>#include <limits.h>#include <stdbool.h>#include <string.h>#include <unistd.h>#include "mutt/lib.h"#include "config/lib.h"#include "core/lib.h"#include "gui/lib.h"#include "get.h"#include "menu/lib.h"#include "globals.h"#include "keymap.h"#include "menu.h"#include "module_data.h"#include "notify.h"#include "monitor.h"
Include dependency graph for get.c:Go to the source code of this file.
Enumerations | |
| enum | DokeyState { DKS_START = 1 , DKS_COUNTER , DKS_NEED_MORE } |
| Internal state for km_dokey() More... | |
Functions | |
| void | mutt_push_macro_repeated (char *macro, int count) |
| Push a macro string into the input queue, optionally repeated. | |
| void | mutt_flushinp (void) |
| MacroEvents moved to KeyModuleData UngetKeyEvents moved to KeyModuleData. | |
| struct KeyEvent * | array_pop (struct KeyEventArray *a) |
| Remove an event from the array. | |
| void | array_add (struct KeyEventArray *a, int ch, int op) |
| Add an event to the end of the array. | |
| void | array_to_endcond (struct KeyEventArray *a) |
| Clear the array until an OP_END_COND. | |
| void | mutt_unget_ch (int ch) |
| Return a keystroke to the input buffer. | |
| void | mutt_unget_op (int op) |
| Return an operation to the input buffer. | |
| void | mutt_push_macro_event (int ch, int op) |
| Add the character/operation to the macro buffer. | |
| void | mutt_flush_macro_to_endcond (void) |
| Drop a macro from the input buffer. | |
| static int | mutt_monitor_getch_timeout (int timeout_ms) |
| Get a character and poll the filesystem monitor. | |
| static struct KeyEvent | mutt_getch_timeout (GetChFlags flags, int timeout_ms) |
| Read a character from the input buffer with timeout. | |
| struct KeyEvent | mutt_getch (GetChFlags flags) |
| Read a character from the input buffer. | |
| void | km_error_key (const struct MenuDefinition *md) |
| Handle an unbound key sequence. | |
| void | generic_tokenize_push_string (char *s) |
| Parse and queue a 'push' command. | |
| KeyGatherFlags | gather_functions (const struct MenuDefinition *md, const keycode_t *keys, int key_len, struct KeymapMatchArray *kma) |
| Find functions whose keybindings match. | |
| static void | key_progress_notify (const struct MenuDefinition *md, int count, const keycode_t *keys, int key_len, GetChFlags flags) |
| Send key matching progress notification. | |
| struct KeyEvent | km_dokey (const struct MenuDefinition *md, GetChFlags flags) |
| Determine what a keypress should do. | |
Variables | |
| static const int | MaxKeyLoop = 64 |
| XXX. | |
Get a key from the user.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file get.c.
| enum DokeyState |
Internal state for km_dokey()
| Enumerator | |
|---|---|
| DKS_START | Initial state, no input received yet. |
| DKS_COUNTER | Reading count prefix digits. |
| DKS_NEED_MORE | Prefix matches an exact and/or longer keybinding. |
| void mutt_push_macro_repeated | ( | char * | macro, |
| int | count ) |
Push a macro string into the input queue, optionally repeated.
| macro | Macro string to expand |
| count | Number of times to repeat (0 or 1 means once) |
The repeat count is clamped to $macro_repeat_max to bound queue growth.
Definition at line 60 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_flushinp | ( | void | ) |
MacroEvents moved to KeyModuleData UngetKeyEvents moved to KeyModuleData.
Empty all the keyboard buffers
Definition at line 81 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct KeyEvent * array_pop | ( | struct KeyEventArray * | a | ) |
Remove an event from the array.
| a | Array |
| ptr | Event |
Definition at line 102 of file get.c.
Here is the caller graph for this function:| void array_add | ( | struct KeyEventArray * | a, |
| int | ch, | ||
| int | op ) |
| void array_to_endcond | ( | struct KeyEventArray * | a | ) |
| void mutt_unget_ch | ( | int | ch | ) |
| void mutt_unget_op | ( | int | op | ) |
| void mutt_push_macro_event | ( | int | ch, |
| int | op ) |
Add the character/operation to the macro buffer.
| ch | Character to add |
| op | Operation to add |
Adds the ch/op to the macro buffer. This should be used for macros, push, and exec commands only.
Definition at line 173 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_flush_macro_to_endcond | ( | void | ) |
Drop a macro from the input buffer.
All the macro text is deleted until an OP_END_COND command, or the buffer is empty.
Definition at line 185 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Get a character and poll the filesystem monitor.
| timeout_ms | Timeout in milliseconds |
| num | Character pressed |
| ERR | Timeout |
Definition at line 198 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read a character from the input buffer with timeout.
| flags | Flags, e.g. GETCH_IGNORE_MACRO |
| timeout_ms | Timeout in milliseconds |
| obj | KeyEvent to process |
Definition at line 222 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct KeyEvent mutt_getch | ( | GetChFlags | flags | ) |
Read a character from the input buffer.
| flags | Flags, e.g. GETCH_IGNORE_MACRO |
| obj | KeyEvent to process |
The priority for reading events is:
This function can return:
{ 0, OP_ABORT, 0 }{ 0, OP_REPAINT, 0 }{ 0, OP_TIMEOUT, 0 } Definition at line 319 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void km_error_key | ( | const struct MenuDefinition * | md | ) |
Handle an unbound key sequence.
| md | Menu Definition |
Definition at line 328 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void generic_tokenize_push_string | ( | char * | s | ) |
Parse and queue a 'push' command.
| s | String to push into the key queue |
Parses s for <function> syntax and adds the whole sequence the macro buffer.
Definition at line 352 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| KeyGatherFlags gather_functions | ( | const struct MenuDefinition * | md, |
| const keycode_t * | keys, | ||
| int | key_len, | ||
| struct KeymapMatchArray * | kma ) |
Find functions whose keybindings match.
| [in] | md | Menu Definition of all valid functions |
| [in] | keys | User-entered key string to match |
| [in] | key_len | Length of key string |
| [out] | kma | Array for the results |
| flags | Results, e.g. KEY_GATHER_MATCH |
Definition at line 427 of file get.c.
Here is the caller graph for this function:
|
static |
Send key matching progress notification.
| md | Menu Definition |
| count | Parsed count prefix |
| keys | Entered keys |
| key_len | Number of entered keys |
| flags | Flags, e.g. GETCH_NO_FEEDBACK |
Definition at line 493 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct KeyEvent km_dokey | ( | const struct MenuDefinition * | md, |
| GetChFlags | flags ) |
Determine what a keypress should do.
| md | Menu Definition |
| flags | Flags, e.g. GETCH_IGNORE_MACRO |
| ptr | Event |
Definition at line 518 of file get.c.
Here is the call graph for this function:
Here is the caller graph for this function: