Ask the user for a string.
182{
186
188
192
193 int rc = 0;
194 int col = 0;
195
197
200
204
207 do
208 {
210 {
213 clearok(stdscr, true);
215 }
222
224 mbstate_t mbstate = { 0 };
225
226
230
232
233 if (es->
wbuf[0] == L
'\0')
234 {
235
240 }
241 else
242 {
245 }
246
259 else
261
262 do
263 {
266 {
268 {
269
274 }
278 {
282 }
284 int w = 0;
285 for (
size_t i = wdata.
state->
begin; i < wdata.state->lastchar; i++)
286 {
288 if (w > width)
289 break;
291 }
297 0);
298 }
299
300
301 int r = 0, c = 0;
305
308 {
310 goto bye;
311 }
312
313 if (event.
op == OP_NULL)
314 {
317 else
320 {
321 rc = 0;
322 goto bye;
323 }
324 continue;
325 }
326 else
327 {
330 }
331
333 if ((event.
op != OP_EDITOR_COMPLETE) && (event.
op != OP_EDITOR_COMPLETE_QUERY))
337 switch (rc_disp)
338 {
340 {
342 {
343 rc = 0;
344 goto bye;
345 }
346 break;
347 }
349 rc = 1;
350 goto bye;
351
353 break;
354
357 default:
359 }
360 }
while (!wdata.
done);
361
362 bye:
366 } while (rc == 1);
368
370
377
378 if (rc == 0)
380 else
382
384
386 return rc;
387}
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.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_PROMPT
Question/user input.
void mutt_refresh(void)
Force a refresh of the screen.
void completion_data_free(struct CompletionData **ptr)
Free the Completion Data.
@ FR_SUCCESS
Valid function - successfully performed.
@ 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.
@ 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.
static int my_addwch(struct MuttWindow *win, wchar_t wc)
Display one wide character on screen.
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
bool OptIgnoreMacroEvents
(pseudo) don't process macro/push/exec events while set
int enter_function_dispatcher(struct MuttWindow *win, int op)
Perform an Enter function - Implements function_dispatcher_t -.
#define mutt_debug(LEVEL,...)
@ HC_COMMAND
NeoMutt commands.
@ HC_OTHER
Miscellaneous strings.
@ HC_CMD
External commands.
void mutt_hist_reset_state(enum HistoryClass hclass)
Move the 'current' position to the end of the History.
struct KeyEvent km_dokey_event(enum MenuType mtype)
Determine what a keypress should do.
@ LL_DEBUG1
Log at debug level 1.
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
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.
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
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.
#define MUTT_COMP_ALIAS
Alias completion (in alias dialog)
#define MUTT_COMP_PASS
Password mode (no echo)
#define MUTT_COMP_UNBUFFERED
Ignore macro buffer.
#define MUTT_COMP_PATTERN
Pattern mode (in pattern dialog)
#define MUTT_COMP_FILE
File completion (in browser)
#define MUTT_COMP_COMMAND
Complete a NeoMutt command.
#define MUTT_COMP_FILE_SIMPLE
File completion (no browser)
#define MUTT_COMP_FILE_MBOX
File completion, plus incoming folders (in browser)
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
struct AttrColor * mutt_curses_set_normal_backed_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
MuttCursorState
Cursor states for mutt_curses_set_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.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
#define WA_RECALC
Recalculate the contents of the Window.
@ WT_CUSTOM
Window with a custom drawing function.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
#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.
Keep our place when entering a string.
size_t begin
Position of the start.
Data to fill the Enter Window.
struct CompletionData * cd
Auto-completion state data.
bool done
Is text-entry done?
int col
Initial cursor positions.
wchar_t * tempbuf
Buffer used by completion.
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
struct Mailbox * m
Mailbox.
An event such as a keypress.
int op
Function opcode, e.g. OP_HELP.
Mapping between user-readable string and a constant.
const struct Mapping * help_data
Data for the Help Bar.
struct WindowState state
Current state of the Window.
void * wdata
Private data.
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
@ MENU_EDITOR
Text entry area.