Most of these were just message update/clearing. -- 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 1461374852 25200 # Fri Apr 22 18:27:32 2016 -0700 # Node ID 550d805f7b6457567db295ceede777f9c133abe7 # Parent 57c2eff41c049fc9b018f6fd5e623b3fc6aea698 Fix remaining direct usages of COLS/LINES to use mutt window functions.
Most of these were just message update/clearing.
diff --git a/buffy.c b/buffy.c
--- a/buffy.c
+++ b/buffy.c
@@ -506,17 +506,18 @@
{
/* Is there new mail in this mailbox? */
if (!tmp->new || (have_unnotified && tmp->notified))
continue;
strfcpy (path, tmp->path, sizeof (path));
mutt_pretty_mailbox (path, sizeof (path));
- if (!first && (COLS - 7 >= 0) && (pos + strlen (path) >= (size_t)COLS - 7))
+ if (!first && (MuttMessageWindow->cols >= 7) &&
+ (pos + strlen (path) >= (size_t)MuttMessageWindow->cols - 7))
break;
if (!first)
pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos));
/* __STRNCAT_CHECKED__ */
/* Prepend an asterisk to mailboxes not already notified */
if (!tmp->notified)
{
diff --git a/commands.c b/commands.c
--- a/commands.c
+++ b/commands.c
@@ -304,35 +304,35 @@
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr, 1);
#define extra_space (15 + 7 + 2)
snprintf (scratch, sizeof (scratch),
(h ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
- if (mutt_strwidth (prompt) > COLS - extra_space)
+ if (mutt_strwidth (prompt) > MuttMessageWindow->cols - extra_space)
{
mutt_format_string (prompt, sizeof (prompt),
- 0, COLS-extra_space, FMT_LEFT, 0,
+ 0, MuttMessageWindow->cols-extra_space, FMT_LEFT, 0,
scratch, sizeof (scratch), 0);
safe_strcat (prompt, sizeof (prompt), "...?");
}
else
snprintf (prompt, sizeof (prompt), "%s?", scratch);
if (query_quadoption (OPT_BOUNCE, prompt) != M_YES)
{
rfc822_free_address (&adr);
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (MuttMessageWindow, 0);
mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
return;
}
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (MuttMessageWindow, 0);
rc = mutt_bounce_message (NULL, h, adr);
rfc822_free_address (&adr);
/* If no error, or background, display message. */
if ((rc == 0) || (rc == S_BKG))
mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
}
@@ -593,17 +593,17 @@
buf[0] = 0;
if (mutt_get_field (_("Shell command: "), buf, sizeof (buf), M_CMD) == 0)
{
if (!buf[0] && Shell)
strfcpy (buf, Shell, sizeof (buf));
if(buf[0])
{
- CLEARLINE (LINES-1);
+ mutt_window_clearline (MuttMessageWindow, 0);
mutt_endwin (NULL);
fflush (stdout);
if (mutt_system (buf) != 0 || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
}
}
}
diff --git a/flags.c b/flags.c
--- a/flags.c
+++ b/flags.c
@@ -317,28 +317,29 @@
/* not reached */
}
int mutt_change_flag (HEADER *h, int bf)
{
int i, flag;
event_t event;
- mvprintw (LINES - 1, 0, "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear
flag"));
- clrtoeol ();
+ mutt_window_mvprintw (MuttMessageWindow, 0, 0,
+ "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear
flag"));
+ mutt_window_clrtoeol (MuttMessageWindow);
event = mutt_getch();
i = event.ch;
if (i < 0)
{
- CLEARLINE (LINES-1);
+ mutt_window_clearline (MuttMessageWindow, 0);
return (-1);
}
- CLEARLINE (LINES-1);
+ mutt_window_clearline (MuttMessageWindow, 0);
switch (i)
{
case 'd':
case 'D':
flag = M_DELETE;
break;
diff --git a/handler.c b/handler.c
--- a/handler.c
+++ b/handler.c
@@ -786,17 +786,18 @@
long bytes = a->length;
struct enriched_state stte;
wchar_t wc = 0;
int tag_len = 0;
wchar_t tag[LONG_STRING + 1];
memset (&stte, 0, sizeof (stte));
stte.s = s;
- stte.WrapMargin = ((s->flags & M_DISPLAY) ? (COLS-4) :
((COLS-4)<72)?(COLS-4):72);
+ stte.WrapMargin = ((s->flags & M_DISPLAY) ? (MuttIndexWindow->cols-4) :
+
((MuttIndexWindow->cols-4)<72)?(MuttIndexWindow->cols-4):72);
stte.line_max = stte.WrapMargin * 4;
stte.line = (wchar_t *) safe_calloc (1, (stte.line_max + 1) * sizeof
(wchar_t));
stte.param = (wchar_t *) safe_calloc (1, (STRING) * sizeof (wchar_t));
stte.param_len = STRING;
stte.param_used = 0;
if (s->prefix)
diff --git a/help.c b/help.c
--- a/help.c
+++ b/help.c
@@ -204,26 +204,26 @@
int col_a, col_b;
int split;
int n;
fputs (t1, f);
/* don't try to press string into one line with less than 40 characters.
The double parenthesis avoids a gcc warning, sigh ... */
- if ((split = COLS < 40))
+ if ((split = MuttIndexWindow->cols < 40))
{
col_a = col = 0;
col_b = LONG_STRING;
fputc ('\n', f);
}
else
{
- col_a = COLS > 83 ? (COLS - 32) >> 2 : 12;
- col_b = COLS > 49 ? (COLS - 10) >> 1 : 19;
+ col_a = MuttIndexWindow->cols > 83 ? (MuttIndexWindow->cols - 32) >> 2 :
12;
+ col_b = MuttIndexWindow->cols > 49 ? (MuttIndexWindow->cols - 10) >> 1 :
19;
col = pad (f, mutt_strwidth(t1), col_a);
}
if (ismacro > 0)
{
if (!mutt_strcmp (Pager, "builtin"))
fputs ("_\010", f);
fputs ("M ", f);
@@ -247,17 +247,17 @@
{
print_macro (f, LONG_STRING, &t3);
fputc ('\n', f);
}
else
{
while (*t3)
{
- n = COLS - col;
+ n = MuttIndexWindow->cols - col;
if (ismacro >= 0)
{
SKIPWS(t3);
n = get_wrapped_width (t3, n);
}
n = print_macro (f, n, &t3);
@@ -266,17 +266,17 @@
{
if (mutt_strcmp (Pager, "builtin"))
{
fputc ('\n', f);
n = 0;
}
else
{
- n += col - COLS;
+ n += col - MuttIndexWindow->cols;
if (option (OPTMARKERS))
++n;
}
col = pad (f, n, col_b);
}
}
}
diff --git a/init.c b/init.c
--- a/init.c
+++ b/init.c
@@ -108,17 +108,17 @@
switch (v)
{
case M_YES:
case M_NO:
return (v);
default:
v = mutt_yesorno (prompt, (v == M_ASKYES));
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (MuttMessageWindow, 0);
return (v);
}
/* not reached */
}
/* given the variable ``s'', return the index into the rc_vars array which
matches, or -1 if the variable is not found. */
diff --git a/keymap.c b/keymap.c
--- a/keymap.c
+++ b/keymap.c
@@ -1124,17 +1124,17 @@
/*
* prompts the user to enter a keystroke, and displays the octal value back
* to the user.
*/
void mutt_what_key (void)
{
int ch;
- mvprintw(LINES-1,0, _("Enter keys (^G to abort): "));
+ mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (^G to abort):
"));
do {
ch = getch();
if (ch != ERR && ch != ctrl ('G'))
{
mutt_message(_("Char = %s, Octal = %o, Decimal = %d"),
km_keyname(ch), ch, ch);
}
}
diff --git a/mutt_curses.h b/mutt_curses.h
--- a/mutt_curses.h
+++ b/mutt_curses.h
@@ -59,18 +59,18 @@
/* AIX defines ``lines'' in <term.h>, but it's used as a var name in
* various places in Mutt
*/
#ifdef lines
#undef lines
#endif /* lines */
-#define CLEARLINE(x) move(x,0), clrtoeol()
-#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
+#define CLEARLINE(win,x) mutt_window_clearline(win, x)
+#define CENTERLINE(win,x,y) mutt_window_move(win, y, (win->cols-strlen(x))/2),
addstr(x)
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
#if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
#define curs_set(x)
#endif
#if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
void mutt_curs_set (int);
diff --git a/muttlib.c b/muttlib.c
--- a/muttlib.c
+++ b/muttlib.c
@@ -1568,17 +1568,17 @@
}
else
{
mutt_perror (s);
return 1;
}
}
- CLEARLINE (LINES-1);
+ mutt_window_clearline (MuttMessageWindow, 0);
return (ret);
}
void state_prefix_putc (char c, STATE *s)
{
if (s->flags & M_PENDINGPREFIX)
{
state_reset_prefix (s);
diff --git a/recvattach.c b/recvattach.c
--- a/recvattach.c
+++ b/recvattach.c
@@ -585,17 +585,17 @@
char warning[STRING+_POSIX_PATH_MAX];
if (filter)
{
snprintf (warning, sizeof (warning),
_("WARNING! You are about to overwrite %s, continue?"),
body->filename);
if (mutt_yesorno (warning, M_NO) != M_YES) {
- CLEARLINE (LINES-1);
+ mutt_window_clearline (MuttMessageWindow, 0);
return;
}
mutt_mktemp (tfile, sizeof (tfile));
}
else
tfile[0] = 0;
if (mutt_pipe_attachment (fp, body, command, tfile))
diff --git a/recvcmd.c b/recvcmd.c
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -198,35 +198,35 @@
#define extra_space (15+7+2)
/*
* See commands.c.
*/
snprintf (prompt, sizeof (prompt) - 4,
(p ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
- if (mutt_strwidth (prompt) > COLS - extra_space)
+ if (mutt_strwidth (prompt) > MuttMessageWindow->cols - extra_space)
{
mutt_format_string (prompt, sizeof (prompt) - 4,
- 0, COLS-extra_space, FMT_LEFT, 0,
+ 0, MuttMessageWindow->cols-extra_space, FMT_LEFT, 0,
prompt, sizeof (prompt), 0);
safe_strcat (prompt, sizeof (prompt), "...?");
}
else
safe_strcat (prompt, sizeof (prompt), "?");
if (query_quadoption (OPT_BOUNCE, prompt) != M_YES)
{
rfc822_free_address (&adr);
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (MuttMessageWindow, 0);
mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
return;
}
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (MuttMessageWindow, 0);
if (cur)
ret = mutt_bounce_message (fp, cur->hdr, adr);
else
{
for (i = 0; i < idxlen; i++)
{
if (idx[i]->content->tagged)
diff --git a/sendlib.c b/sendlib.c
--- a/sendlib.c
+++ b/sendlib.c
@@ -1851,18 +1851,18 @@
/* when not displaying, use sane wrap value */
if (!(flags & CH_DISPLAY))
{
if (WrapHeaders < 78 || WrapHeaders > 998)
wraplen = 78;
else
wraplen = WrapHeaders;
}
- else if (wraplen <= 0 || wraplen > COLS)
- wraplen = COLS;
+ else if (wraplen <= 0 || wraplen > MuttIndexWindow->cols)
+ wraplen = MuttIndexWindow->cols;
if (tag)
{
/* if header is short enough, simply print it */
if (!(flags & CH_DISPLAY) && mutt_strwidth (tag) + 2 + pfxw +
mutt_strwidth (v) <= wraplen)
{
dprint(4,(debugfile,"mwoh: buf[%s%s: %s] is short enough\n",
signature.asc
Description: PGP signature
