This modifies the mutt_enter_string() functions to use MuttMessageWindow. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1461089224 25200 # Tue Apr 19 11:07:04 2016 -0700 # Node ID b33fd23aa70792ccb8261c0d33dc3ef0ed7bc277 # Parent e79f81c7461d1e90dea3f8ef2a693ecead6a58bb Modify enter.c routines to use windows.
This modifies the mutt_enter_string() functions to use MuttMessageWindow.
diff --git a/curs_lib.c b/curs_lib.c
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -146,29 +146,29 @@
ret.ch = ch;
ret.op = 0;
return (ch == ctrl ('G') ? err : ret);
}
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();
do
{
mutt_window_clearline (MuttMessageWindow, 0);
SETCOLOR (MT_COLOR_PROMPT);
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);
+ x = getcurx (stdscr);
+ ret = _mutt_enter_string (buf, buflen, x, complete, multiple, files,
numfiles, es);
}
while (ret == 1);
mutt_window_clearline (MuttMessageWindow, 0);
mutt_free_enter_state (&es);
return (ret);
}
diff --git a/edit.c b/edit.c
--- a/edit.c
+++ b/edit.c
@@ -237,17 +237,17 @@
move (LINES-1, 0);
addstr ("To: ");
tmp[0] = 0;
mutt_addrlist_to_local (e->to);
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);
e->to = mutt_expand_aliases (e->to);
mutt_addrlist_to_intl (e->to, NULL); /* XXX - IDNA error reporting?
*/
tmp[0] = 0;
rfc822_write_address (tmp, sizeof (tmp), e->to, 1);
mvaddstr (LINES - 1, 4, tmp);
@@ -259,28 +259,28 @@
addstr (tmp);
}
addch ('\n');
if (!e->subject || force)
{
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');
}
if ((!e->cc && option (OPTASKCC)) || force)
{
addstr ("Cc: ");
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);
e->cc = mutt_expand_aliases (e->cc);
tmp[0] = 0;
mutt_addrlist_to_intl (e->cc, NULL);
rfc822_write_address (tmp, sizeof (tmp), e->cc, 1);
mvaddstr (LINES - 1, 4, tmp);
@@ -291,17 +291,17 @@
}
if (option (OPTASKBCC) || force)
{
addstr ("Bcc: ");
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);
e->bcc = mutt_expand_aliases (e->bcc);
mutt_addrlist_to_intl (e->bcc, NULL);
tmp[0] = 0;
rfc822_write_address (tmp, sizeof (tmp), e->bcc, 1);
mvaddstr (LINES - 1, 5, tmp);
@@ -328,17 +328,17 @@
addstr (_("(End message with a . on a line by itself)\n"));
buf = be_snarf_file (path, buf, &bufmax, &buflen, 0);
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;
}
addch ('\n');
if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0])
{
diff --git a/enter.c b/enter.c
--- a/enter.c
+++ b/enter.c
@@ -205,30 +205,30 @@
/*
* Returns:
* 1 need to redraw the screen and call me again
* 0 if input was given
* -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;
int ch, w, r;
size_t i;
wchar_t *tempbuf = 0;
size_t templen = 0;
history_class_t hclass;
@@ -275,27 +275,28 @@
{
/* Go to end of line */
state->curpos = state->lastchar;
state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth
(state->wbuf, state->lastchar) - width + 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++)
{
w += my_wcwidth (state->wbuf[i]);
if (w > width)
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 ();
if ((ch = km_dokey (MENU_EDITOR)) == -1)
{
rv = -1;
goto bye;
}
diff --git a/protos.h b/protos.h
--- a/protos.h
+++ b/protos.h
@@ -296,18 +296,18 @@
int mutt_chscmp (const char *s, const char *chs);
#define mutt_is_utf8(a) mutt_chscmp (a, "utf-8")
#define mutt_is_us_ascii(a) mutt_chscmp (a, "us-ascii")
int mutt_parent_message (CONTEXT *, HEADER *);
int mutt_prepare_template(FILE*, CONTEXT *, HEADER *, HEADER *, short);
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 *);
int mutt_get_field_unbuffered (char *, char *, size_t, int);
#define mutt_get_password(A,B,C) mutt_get_field_unbuffered(A,B,C,M_PASS)
int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
int mutt_get_tmp_attachment (BODY *);
int mutt_index_menu (void);
signature.asc
Description: PGP signature
