<<< Date Index >>>     <<< Thread Index >>>

fixing mutt



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.