fixing mutt
- To: mutt-dev@xxxxxxxx
- Subject: fixing mutt
- From: b a <randomcoder1@xxxxxxxxx>
- Date: Fri, 10 Jul 2009 05:24:51 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Jttno7pjnc+hXpotfSWj8rsHWXDzsQenwV/c3UtVJgo=; b=jhMHLZeMLBFZZX8MJvTTdO/gE5u9ltxg3xfaBSAVd8r339kXnba6kYVhbyABPX29Qx ktTfUiVJM2hJsCpmFhJ10s9mGaS9s3gdEkFLU5Rum581LBC734TchsIq3Sy5NmNoprIk A4f8R0LqPDr9MDUdESlXJi6eNv+av2nHuvh6s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=E798scan3Yqz8B7/xvj1IMPREf8ARv1gatFsUzOICpVwZQbtCzNmkS1rijR8lYpeky TtZX49cM07gAHHnmm91uwWLOMHAEiDu/TRP+oOd+ym8yVClTyDGRFWZp5MiHvU7oGR2V qsH14KRumLh2NbMnaNVVeg5hLoNyiCBoiEz1Q=
- List-post: <mailto:mutt-dev@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-dev"
- Sender: owner-mutt-dev@xxxxxxxx
Hi,
I came here because I have a problem with mutt and I will fix it.
When pressing <enter> to view an email with a big attachement mutt
becomes unresponsive until the message is fetched.
I don't like this and I will fix it in the next few days by binding
the escape key to break the loop on lines 463 - 516 inside message.c
in imap_fetch_message.That loop is getting the message,and if it's
22MB for example you'll have to wait for some time , what if you
decide you DON'T want to download it any more and you want to
interrupt the fetching process?
I thought and probably ncurses has some kind of event loop (I have not
worked with ncurses before and I'm not much of a C programmer but I
know C) and one solution could be to let ncurses take a look at it's
event loop while running the big loop.
Another solution would be to use some code I found in curs_lib.c this ->
91 mutt_allow_interrupt (1);
92 #ifdef KEY_RESIZE
93 /* ncurses 4.2 sends this when the screen is resized */
94 ch = KEY_RESIZE;
95 while (ch == KEY_RESIZE)
96 #endif /* KEY_RESIZE */
97 ch = getch ();
98 mutt_allow_interrupt (0);
I will probably have to use a mutt_getch inside the big loop.
I need to be sure that the key the user presses will be caught.
Will this happen or not ?
I am also consider using this piece of code
int i;
FD_ZERO(&fds);
FD_SET(STDIN_FILENO, &fds);
tv.tv_sec = tv.tv_usec = 0;
i = select(1, &fds, NULL, NULL, &tv);
if (i == -1) return(MFALSE);
if (FD_ISSET(STDIN_FILENO, &fds)) return(MTRUE);
return(MFALSE);
Which should be the equivalent of kbhit() and tell me if the keyboard
event queue has some keys on it or not , then I will check to see if
Esc is there and if it is I will exit the loop.
To break it down, I need a non-blocking getch.
I will not stop until I will fix this , I want to be able to properly
read my email.
Anyone who knows more about ncurses and about how it interacts with
blocking operations COME FORTH and speak your mind and if you have a
suggestion for what/where I should read that would be even better.
A Coder.