Show
Ignore:
Timestamp:
2000-12-31 03:24:18 (8 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Make browser behaviour more consistent with expectations.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • browser.c

    r2150 r2224  
    5252 
    5353static char LastDir[_POSIX_PATH_MAX] = ""; 
     54static char LastDirBackup[_POSIX_PATH_MAX] = ""; 
    5455 
    5556/* Frees up the memory allocated for the local-global variables.  */ 
     
    519520} 
    520521 
    521 void _mutt_select_file (char *f, size_t flen, int buffy, 
    522                        int multiple, char ***files, int *numfiles) 
     522void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *numfiles) 
    523523{ 
    524524  char buf[_POSIX_PATH_MAX]; 
     
    530530  struct stat st; 
    531531  int i, killPrefix = 0; 
    532  
     532  int multiple = (flags & M_SEL_MULTI)  ? 1 : 0; 
     533  int folder   = (flags & M_SEL_FOLDER) ? 1 : 0; 
     534  int buffy    = (flags & M_SEL_BUFFY)  ? 1 : 0; 
     535 
     536  buffy = buffy && folder; 
     537   
    533538  memset (&state, 0, sizeof (struct browser_state)); 
     539 
     540  if (!folder) 
     541    strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup)); 
    534542 
    535543  if (*f) 
     
    582590  else  
    583591  { 
    584     if (!LastDir[0]) 
     592    if (!folder) 
     593      getcwd (LastDir, sizeof (LastDir)); 
     594    else if (!LastDir[0]) 
    585595      strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir)); 
     596     
    586597#ifdef USE_IMAP 
    587598    if (!buffy && mx_is_imap (LastDir)) 
     
    599610  { 
    600611    if (examine_mailboxes (NULL, &state) == -1) 
    601       return; 
     612      goto bail; 
    602613  } 
    603614  else 
     
    606617#endif 
    607618  if (examine_directory (NULL, &state, LastDir, prefix) == -1) 
    608     return; 
     619    goto bail; 
    609620 
    610621  menu = mutt_new_menu (); 
     
    743754              { 
    744755                strfcpy (LastDir, NONULL(Homedir), sizeof (LastDir)); 
    745                 return; 
     756                goto bail; 
    746757              } 
    747758            } 
     
    803814        destroy_state (&state); 
    804815        mutt_menuDestroy (&menu); 
    805         return; 
     816        goto bail; 
    806817 
    807818      case OP_BROWSER_TELL: 
     
    937948                destroy_state (&state); 
    938949                mutt_menuDestroy (&menu); 
    939                 return; 
     950                goto bail; 
    940951              } 
    941952            } 
     
    10031014              mutt_error _("Error scanning directory."); 
    10041015              mutt_menuDestroy (&menu); 
    1005               return; 
     1016              goto bail; 
    10061017            } 
    10071018            killPrefix = 0; 
     
    10691080        { 
    10701081          if (examine_mailboxes (menu, &state) == -1) 
    1071             return; 
     1082            goto bail; 
    10721083        } 
    10731084#ifdef USE_IMAP 
     
    10811092#endif 
    10821093        else if (examine_directory (menu, &state, LastDir, prefix) == -1) 
    1083           return; 
     1094          goto bail; 
    10841095        init_menu (&state, menu, title, sizeof (title), buffy); 
    10851096        break; 
     
    10931104          destroy_state (&state); 
    10941105          mutt_menuDestroy (&menu); 
    1095           return; 
     1106          goto bail; 
    10961107        } 
    10971108        MAYBE_REDRAW (menu->redraw); 
     
    11111122          destroy_state (&state); 
    11121123          mutt_menuDestroy (&menu); 
    1113           return; 
     1124          goto bail; 
    11141125        } 
    11151126        else 
     
    11411152    } 
    11421153  } 
    1143   /* not reached */ 
    1144 } 
     1154   
     1155  bail: 
     1156   
     1157  if (!folder) 
     1158    strfcpy (LastDir, LastDirBackup, sizeof (LastDir)); 
     1159   
     1160}