customize this is of course the Mutt way. */
void mutt_need_hard_redraw (void)
{
- if (!getenv ("DISPLAY"))
- {
- keypad (stdscr, TRUE);
- clearok (stdscr, TRUE);
- set_option (OPTNEEDREDRAW);
- }
+ keypad (stdscr, TRUE);
+ clearok (stdscr, TRUE);
+ set_option (OPTNEEDREDRAW);
}
event_t mutt_getch (void)
{
int ch;
event_t err = {-1, OP_NULL }, ret;
+ event_t timeout = {-2, OP_NULL};
if (!option(OPTUNBUFFEREDINPUT) && UngetCount)
return (KeyEvent[--UngetCount]);
endwin ();
exit (1);
}
- return err;
+ return timeout;
}
if ((ch & 0x80) && option (OPTMETAKEY))
mutt_error (_("Error running \"%s\"!"), cmd);
mutt_sleep (2);
}
+#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM)
+ /* the terminal may have been resized while the editor owned it */
+ mutt_resize_screen ();
+#endif
keypad (stdscr, TRUE);
clearok (stdscr, TRUE);
}
ch = mutt_getch ();
if (CI_is_return (ch.ch))
break;
- if (ch.ch == -1)
+ if (ch.ch < 0)
{
def = -1;
break;
if (!progress)
return;
+ if (option(OPTNOCURSES))
+ return;
+
memset (progress, 0, sizeof (progress_t));
progress->inc = inc;
progress->flags = flags;
dprint (1, (debugfile, "gettimeofday failed: %d\n", errno));
/* if timestamp is 0 no time-based suppression is done */
if (TimeInc)
- progress->timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ progress->timestamp = ((unsigned int) tv.tv_sec * 1000)
+ + (unsigned int) (tv.tv_usec / 1000);
mutt_progress_update (progress, 0, 0);
}
struct timeval tv = { 0, 0 };
unsigned int now = 0;
+ if (option(OPTNOCURSES))
+ return;
+
if (!progress->inc)
goto out;
/* skip refresh if not enough time has passed */
if (update && progress->timestamp && !gettimeofday (&tv, NULL)) {
- now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ now = ((unsigned int) tv.tv_sec * 1000)
+ + (unsigned int) (tv.tv_usec / 1000);
if (now && now - progress->timestamp < TimeInc)
update = 0;
}
if (update)
{
- dprint (1, (debugfile, "Updating progress: %ld\n", pos));
if (progress->flags & M_PROGRESS_SIZE)
{
pos = pos / (progress->inc << 10) * (progress->inc << 10);
}
else
snprintf (posstr, sizeof (posstr), "%ld", pos);
-
+
+ dprint (5, (debugfile, "updating progress: %s\n", posstr));
+
progress->pos = pos;
if (now)
progress->timestamp = now;
mutt_refresh ();
ch = mutt_getch();
- if (ch.ch == -1)
+ if (ch.ch < 0)
{
CLEARLINE (LINES-1);
return (-1);
{
mutt_refresh ();
ch = mutt_getch ();
- if (ch.ch == -1 || CI_is_return (ch.ch))
+ if (ch.ch < 0 || CI_is_return (ch.ch))
{
choice = -1;
break;