Ask the user for a string and call a notify function on keypress.
269{
272
276
277 struct Buffer *cbuf = NULL;
278 if (callback)
280
281 if (!md)
283
284 int rc = 0;
285
287
290
293
294 mbstate_t mbstate = { 0 };
295
296 struct EnterWindowData wdata = { buf, complete, es,
hclass,
comp_api,
cdata,
prompt,
ENTER_REDRAW_NONE, (complete &
MUTT_COMP_PASS),
true, NULL, 0, &
mbstate, 0,
false, NULL, 0, 0 };
297
298
304
306
307 if (es->
wbuf[0] == L
'\0')
308 {
309
314 }
315 else
316 {
319 }
320
321 do
322 {
324
325 do
326 {
329
335 {
336 continue;
337 }
338
340 {
341 rc = -1;
342 goto bye;
343 }
344
345 if (event.
op == OP_NULL)
346 {
349 else
351
353 {
354 rc = 0;
355 goto bye;
356 }
358 goto notify;
359 }
360 else
361 {
364 }
365
367 if ((event.
op != OP_EDITOR_COMPLETE) && (event.
op != OP_EDITOR_COMPLETE_QUERY))
369
371
373 if (fn_disp)
374 {
375 rc_disp = fn_disp(cb_data, &event);
378 }
379
382
383 switch (rc_disp)
384 {
386 {
388 {
389 rc = 0;
390 goto bye;
391 }
392 break;
393 }
395 rc = 1;
396 goto bye;
397
400 rc = 0;
401 break;
402
404 rc = 0;
405 break;
406
409 default:
411 }
412
413 notify:
414 if (callback)
415 {
418 }
419
420 }
while (!wdata.
done);
421
422 bye:
425 } while (rc == 1);
426
431
432 if (rc == 0)
434 else
436
438
440
441 return rc;
442}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
void mutt_beep(bool force)
Irritate the user.
void completion_data_free(struct CompletionData **ptr)
Free the Completion Data.
@ FR_SUCCESS
Valid function - successfully performed.
@ FR_DONE
Exit the Dialog.
@ FR_UNKNOWN
Unknown function.
@ FR_ERROR
Valid function - error occurred.
@ FR_CONTINUE
Remain in the Dialog.
@ FR_NO_ACTION
Valid function - no action performed.
struct EnterState * enter_state_new(void)
Create a new EnterState.
void enter_state_free(struct EnterState **ptr)
Free an EnterState.
#define MUTT_COMP_PASS
Password mode (no echo)
#define MUTT_COMP_UNBUFFERED
Ignore macro buffer.
@ ENTER_REDRAW_NONE
Nothing to redraw.
@ ENTER_REDRAW_LINE
Redraw entire line.
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
static const struct Mapping EditorHelp[]
Help Bar for the Command Line Editor.
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
struct KeyEvent km_dokey(const struct MenuDefinition *md, GetChFlags flags)
Determine what a keypress should do.
uint8_t GetChFlags
Flags for mutt_getch(), e.g. GETCH_NO_FLAGS.
#define GETCH_IGNORE_MACRO
Don't use MacroEvents.
#define GETCH_NO_FLAGS
No flags are set.
int enter_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform an Enter function - Implements function_dispatcher_t -.
#define mutt_debug(LEVEL,...)
static int enter_recalc(struct MuttWindow *win)
Recalculate the Window data - Implements MuttWindow::recalc() -.
static bool enter_recursor(struct MuttWindow *win)
Recursor the Window - Implements MuttWindow::recursor() -.
static int enter_repaint(struct MuttWindow *win)
Repaint the Window - Implements MuttWindow::repaint() -.
void mutt_hist_reset_state(enum HistoryClass hclass)
Move the 'current' position to the end of the History.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
void buf_mb_wcstombs(struct Buffer *dest, const wchar_t *wstr, size_t wlen)
Convert a string from wide to multibyte characters.
#define FREE(x)
Free memory and set the pointer to NULL.
void msgcont_push_window(struct MuttWindow *win)
Add a window to the Container Stack.
struct MuttWindow * msgcont_pop_window(void)
Remove the last Window from the Container Stack.
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
@ WT_CUSTOM
Window with a custom drawing function.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
#define WA_REPAINT
Redraw the contents of the Window.
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
const char * opcodes_get_name(int op)
Get the name of an opcode.
#define OP_TIMEOUT
1 second with no events
#define OP_REPAINT
Repaint is needed.
#define OP_ABORT
$abort_key pressed (Ctrl-G)
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
Keep our place when entering a string.
size_t wbuflen
Length of buffer.
wchar_t * wbuf
Buffer for the string being entered.
size_t lastchar
Position of the last character.
Data to fill the Enter Window.
int tabs
Number of times the user has hit tab.
void * cdata
Auto-Completion private data.
struct CompletionData * cd
Auto-completion state data.
struct Buffer * buffer
struct Buffer for the result
bool done
Is text-entry done?
bool first
First time through, no input yet.
wchar_t * tempbuf
Buffer used by completion.
const struct CompleteOps * comp_api
Auto-Completion API.
const char * prompt
Prompt.
struct EnterState * state
Current state of text entry.
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
mbstate_t * mbstate
Multi-byte state.
enum HistoryClass hclass
History to use, e.g. HC_NEO_COMMAND.
An event such as a keypress.
int op
Function opcode, e.g. OP_HELP.
const struct Mapping * help_data
Data for the Help Bar.
const struct MenuDefinition * help_md
Menu Definition for key bindings.
int(* repaint)(struct MuttWindow *win)
void * wdata
Private data.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
bool(* recursor)(struct MuttWindow *win)