This modifies the mutt_enter_string() functions to use MuttMessageWindow.
Thanks to Richard Russon for pointing out slang doesn't support getcurx.
int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles)
{
int ret;
- int x, y;
+ int x;
ENTER_STATE *es = mutt_new_enter_state();
addstr ((char *)field); /* cast to get around bad prototypes */
NORMAL_COLOR;
mutt_refresh ();
- getyx (stdscr, y, x);
- ret = _mutt_enter_string (buf, buflen, y, x, complete, multiple, files, numfiles, es);
+ mutt_window_getyx (MuttMessageWindow, &ret, &x); /* don't care about y: avoiding unused var warning */
+ ret = _mutt_enter_string (buf, buflen, x, complete, multiple, files, numfiles, es);
}
while (ret == 1);
mutt_window_clearline (MuttMessageWindow, 0);
rfc822_write_address (tmp, sizeof (tmp), e->to, 0);
if (!e->to || force)
{
- if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 4, 0) == 0)
+ if (mutt_enter_string (tmp, sizeof (tmp), 4, 0) == 0)
{
rfc822_free_address (&e->to);
e->to = mutt_parse_adrlist (e->to, tmp);
{
addstr ("Subject: ");
strfcpy (tmp, e->subject ? e->subject: "", sizeof (tmp));
- if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 9, 0) == 0)
+ if (mutt_enter_string (tmp, sizeof (tmp), 9, 0) == 0)
mutt_str_replace (&e->subject, tmp);
addch ('\n');
}
tmp[0] = 0;
mutt_addrlist_to_local (e->cc);
rfc822_write_address (tmp, sizeof (tmp), e->cc, 0);
- if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 4, 0) == 0)
+ if (mutt_enter_string (tmp, sizeof (tmp), 4, 0) == 0)
{
rfc822_free_address (&e->cc);
e->cc = mutt_parse_adrlist (e->cc, tmp);
tmp[0] = 0;
mutt_addrlist_to_local (e->bcc);
rfc822_write_address (tmp, sizeof (tmp), e->bcc, 0);
- if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 5, 0) == 0)
+ if (mutt_enter_string (tmp, sizeof (tmp), 5, 0) == 0)
{
rfc822_free_address (&e->bcc);
e->bcc = mutt_parse_adrlist (e->bcc, tmp);
tmp[0] = 0;
while (!done)
{
- if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 0, 0) == -1)
+ if (mutt_enter_string (tmp, sizeof (tmp), 0, 0) == -1)
{
tmp[0] = 0;
continue;
* -1 if abort.
*/
-int mutt_enter_string(char *buf, size_t buflen, int y, int x, int flags)
+int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
{
int rv;
ENTER_STATE *es = mutt_new_enter_state ();
- rv = _mutt_enter_string (buf, buflen, y, x, flags, 0, NULL, NULL, es);
+ rv = _mutt_enter_string (buf, buflen, col, flags, 0, NULL, NULL, es);
mutt_free_enter_state (&es);
return rv;
}
-int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
+int _mutt_enter_string (char *buf, size_t buflen, int col,
int flags, int multiple, char ***files, int *numfiles,
ENTER_STATE *state)
{
- int width = COLS - x - 1;
+ int width = MuttMessageWindow->cols - col - 1;
int redraw;
int pass = (flags & M_PASS);
int first = 1;
if (state->curpos < state->begin ||
my_wcswidth (state->wbuf + state->begin, state->curpos - state->begin) >= width)
state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->curpos) - width / 2);
- move (y, x);
+ mutt_window_move (MuttMessageWindow, 0, col);
w = 0;
for (i = state->begin; i < state->lastchar; i++)
{
break;
my_addwch (state->wbuf[i]);
}
- clrtoeol ();
- move (y, x + my_wcswidth (state->wbuf + state->begin, state->curpos - state->begin));
+ mutt_window_clrtoeol (MuttMessageWindow);
+ mutt_window_move (MuttMessageWindow, 0,
+ col + my_wcswidth (state->wbuf + state->begin, state->curpos - state->begin));
}
mutt_refresh ();
int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *);
-int mutt_enter_string (char *buf, size_t buflen, int y, int x, int flags);
-int _mutt_enter_string (char *, size_t, int, int, int, int, char ***, int *, ENTER_STATE *);
+int mutt_enter_string (char *buf, size_t buflen, int col, int flags);
+int _mutt_enter_string (char *, size_t, int, int, int, char ***, int *, ENTER_STATE *);
#define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
int _mutt_get_field (const char *, char *, size_t, int, int, char ***, int *);
int mutt_get_hook_type (const char *);