summaryrefslogtreecommitdiffstats
path: root/browser.c
AgeCommit message (Collapse)Author
2022-05-27Adjust browser and sidebar numeric sorting to use mutt_numeric_cmp()Kevin McCarthy
Large values shouldn't use subtraction into an integer return type, so just convert all of them to use the macro, to be safe.
2022-05-21Fix browser completion path expansion to preserve a trailing slash.Kevin McCarthy
The browser lists the contents of a directory passed as 'f' when it has a trailing slash; without, it lists everything matching that name in the parent directory. Since the browser does its own relative path expansion, we can just use mutt_buffer_path_norel() to keep a trailing slash in 'f'.
2022-01-25Add very basic cd path completion.Kevin McCarthy
This uses existing code to partially complete, and then launch the browser for selection. Unfortunately, completing a path argument brings up other issues, such as quoting, which this currently doesn't handle. It also might be better to rotate through completions rather than launching the file brower. Add a "select directory" mode to the browser, modeled on the IMAP "enter vs select a mailbox with children" behavior: using <view-file> to select the directory and <select-entry> to enter the directory.
2021-09-16Ensure embedded IMAP passwords are stored in context->path.Kevin McCarthy
Without this, IMAP autoreconnect, background-edit Fcc, browser sticky-cursor, and sidebar "current" selection may not work properly. Change imap_qualify_path() to preserve the password if it is present in IMAP_MBOX for the generated URL. In almost all cases, DT_PATH types are run through mutt_pretty_mailbox(), which filters out the passwords, before displaying them in the UI. However there are a few cases where the context->path is displayed directly. Create a new function, mutt_buffer_remove_path_password() to remove it and display that instead.
2021-07-17Silence compiler warning in _mutt_buffer_select_file().Kevin McCarthy
Using a constant offset apparently allows the compiler to be smart enough to detect a potential problem, but it isn't smart enough to see we've already determined lastdirlen is non-zero.
2021-04-25Keep file browser '..' entries at the top.Kevin McCarthy
This makes it easier to navigate up a directory when the file browser is sorted by a value other than "alpha".
2021-04-25Change browser sort "unsorted" to preserve the original order.Kevin McCarthy
Record entry numbers as they are added to the list, so re-sorting by "unsorted" can return to the original order. This is most useful for the mailboxes case, where "unsorted" should mean the order listed in the muttrc.
2021-04-25Add $sort_browser_mailboxes configuration variable.Kevin McCarthy
This allows to control file browser sorting and mailbox browser sorting separately.
2020-08-29Remove relative path expansion for some cases.Kevin McCarthy
Some paths, such as the folder browser, or certain hook values, should be expanded for shortcuts, but not for relative paths. Configuration variables that hold commands that search by PATH should also not be expanded. Create a separate call, and a separate data type for config vars.
2020-05-17Fix attach-file tag operation to work when quitting browser.Kevin McCarthy
There was a disconnect between the compose menu and the behavior when selecting multiple files. The select_file() operation populates the files and numfiles when hitting 'quit'. The compose menu was incorrectly looking at the fname parameter, which won't be populated unless the user presses enter. The enter_string() menu makes the same mistake. Change it to behave differently depending on whether multiple is set. The logic needs to be made clearer by changing the api. I will do that in the next commit.
2020-03-27Add -label and -nopoll arguments to mailboxes commandKevin McCarthy
-nopoll allows adding the mailbox to the sidebar, or the mailbox browser menu, without incurring polling costs. -poll can be used to re-enable polling for a previously disabled mailbox. -label allows specifying an alternative string to show in the sidebar and mailbox browser menu. -nolabel removes a label from an existing mailbox. Change $sidebar_sort_method so that "alpha" and "name" will sort by the label if specified. "path", however, will always sort by the actual mailbox path.
2020-03-06Change mutt_FormatString() data parameter to type void *.Kevin McCarthy
All invocations pass a pointer parameter. Perhaps at one point this was like the init.h combined usage. But as with that, using an unsigned long is incorrect, and we've been lucky to get away with it. Since we don't need a union, just change it to void * to properly size the parameter.
2019-11-10Add gcc comments for fallthrough case statements.Kevin McCarthy
Most of these were already commented. Change a few of them to a format gcc will recognize. In the future, we'll want to change to whatever is standardized.
2019-10-09Add sticky browser behavior for sorting.Kevin McCarthy
The menu isn't rebuilt after sorting, so the selected mailbox was not sticky for that operation. Refactor the sticky cursor setting out so it can be explicitly called after sorting too.
2019-09-22Convert buffer callers of mutt_get_field() to use buffer version.Kevin McCarthy
2019-09-09Change browser <display-filename> to show full_path.Kevin McCarthy
Prior to the introduction of display_name/full_path, it showed "name", which was the full IMAP URL but the shortname for folder/mailbox view. Now that the full_path is available, it makes sense to show that for all cases.
2019-09-09Add $browser_sticky_cursor default set.Kevin McCarthy
This option attempts to keep the browser cursor on the same mailbox. It does this by keeping track of the current selected mailbox and comparing that when regenerating the menu. Modify imap_mailbox_create() and imap_mailbox_rename() to return the new mailbox name so it can be automatically selected.
2019-09-08Rename browser fields to display_name and full_path.Kevin McCarthy
Mailbox and Folder view don't make use of the desc field. They store an abbreviated version in the name field and expand it when selecting or testing it. IMAP stores the full URL in name, and stores an abbreviated version (possibly with a trailing slash) in the desc field. The asymetricity makes it awkward, and interferes with a smart-cursor option in the next commit. So instead rename the fields to "display_name" and "full_path". In Mailfox and Folder view, store the fully expanded path, which we have while iterating, in "full_path", and the shortened version in "display_name". Likewise in IMAP, store the full URL in "full_path" and the shortened version in "display_name". Simplify the code in browser.c to use the full_path instead of concatenating and expanding.
2019-04-16Convert other users of BUFFY->pathbuf to use BUFFERS.Kevin McCarthy
A few functions in browser.c, buffy.c, and monitor.c were using BUFFY->pathbuf but were potentially truncating via fixed size buffers. Convert those to use BUFFERS too. buffy_get() was creating epath and expanding it, apparently to match against expanded BUFFY list entries, was wasn't using the epath. I believe this is a bug, and have switched the comparison to epath.
2019-04-16Convert BUFFER->path to a BUFFER.Kevin McCarthy
Rename to BUFFER->pathbuf to make it clear the field is a BUFFER, and to make sure to catch and review all usages. There are still uses of pathbuf that are truncating and need to be fixed, for example in browser.c and buffy.c. Fix up sidebar usage in one place, that was pointing inside the BUFFY->path with a char *. At the same time, change their "short folder" computation to also use a BUFFER.
2019-03-13browser.c: Convert f parameter to BUFFER.Kevin McCarthy
2019-03-13browser.c: Convert other browser local variables to BUFFER.Kevin McCarthy
2019-03-13browser.c: Convert buf to BUFFER.Kevin McCarthy
2019-03-13browser.c: Convert prefix to BUFFER.Kevin McCarthy
2019-03-13browser.c: Convert LastDir and LastDirBackup to BUFFER.Kevin McCarthy
Add a cleanup method call to main to free the BUFFERS. Add mutt_buffer_concat_path() buffer helper function.
2019-02-02Add an error message for <descend-directory>.Kevin McCarthy
Don't allow the operation on a non-directory. Print a message indicating it's not a directory.
2019-02-02Separate out op variable in the browser.Kevin McCarthy
The i variable is used in several places and scopes as a temporary index variable, but is also used to record the current operation. Separate them out to make the code less confusing.
2019-01-31Allow descending into maildir and mh directories in file browserCorey Minyard
Some (maybe most) IMAP mail systems allow folders to be nested inside folders, so you can have, say, an Inbox with more folders inside it. However, in the file browser, mutt will only open a maildir/mh directory as a mailbox, there is no way to get to the child mailboxes. This change adds a function <descend-directory> that forces mutt to descend into the directory. It is unbound by default. Signed-off-by: Corey Minyard <minyard@acm.org>
2019-01-05Fix a few indenting issues.Kevin McCarthy
These are mostly the result of making the formatting changes commit after the indent changes commit.
2019-01-04Clean up formatting.Kevin McCarthy
Add spaces after if, else, while, for, switch. Unify the brace placement style. The vast majority of the code uses Allman style so convert the relatively few K&R braces over.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-31Remove trailing whitespace.Kevin McCarthy
The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
2018-04-19Add $sort_browser options for count and unread.Kevin McCarthy
2018-04-19Add $browser_abbreviate_mailboxes.Kevin McCarthy
This allows '=' and '~' mailboxes shortcuts to be turned off in the browser mailbox list. The default $sort_browser value of "alpha" uses strcoll(3), which ignores some punctuation. When using multiple accounts with dynamically changing values of $folder, this can lead to an unintuitive sorting order. (See issue #22 for an example.) This problem came about because of commit 8328ce68, which enabled mutt_pretty_mailbox() calls for IMAP and POP mailboxes too. The commit had a valid point about consistency and too-wide mailbox listings, so I don't really want to revert it. This option provides an alternative to completely enable/disable the shortcuts for those who run into an issue.
2018-01-12examine_directory: set directory/symlink size to zeroOlaf Hering
The size of a directory or symlink in the folder browser is not meaningful. For directories it means just how many blocks were allocated to hold all entries. It does not mean that the entries are still present in the directory. For symlinks its the size of the target. Set both to zero to simplify the folder browser output. Signed-off-by: Olaf Hering <olaf@aepfle.de>
2017-09-20Display an error message when delete mailbox fails. (see #3968)Kevin McCarthy
2017-08-10Change helpers functions to pass actx. (see #3728)Kevin McCarthy
Change the pager, compose, recvattach and recvcmd to pass the actx instead of the individual idx and idxlen parameters. Separate out the compose menu exit logic to first free the BODY data and then call the shared actx free function at the bottom.
2017-03-26Set refresh when popping the menu stack.Kevin McCarthy
This removes the need for the OPTNEEDREDRAW option and MAYBE_REDRAW macro previously used to communicate back the need to refresh after exiting a menu. Remove the redraw parameter from ci_bounce_message() and mix_make_chain() which served the same purpose.
2017-03-26Add a menu stack to track current and past menus.Kevin McCarthy
Change the pager to use a MENU, right now just to hold the refresh state.
2017-03-12Add shortcuts for IMAP and POP mailboxes in the file browserDmitri Vereshchagin
Mailbox list may not be properly displayed in a standard 80-column terminal window if the $folder variable contains a long URL. In such a case only left part of each entry name can be visible with the default value of $folder_format. What's worse, this visible part may not be enough to distinguish between the entries. Thus in this case mutt_pretty_mailbox() will be just as useful as for local mailboxes.
2016-09-02merge stableKevin McCarthy
2016-09-02Increase date buffer size for $folder_format. (closes #3863)Kevin McCarthy
The buffer size of 16 was sufficient to hold the %d format, but not for using %D. Change to use a SHORT_STRING. Thanks to Ian Zimmerman for the original patch, and to Antonio Radici for forwarding it on to us.
2016-08-22Remove the $locale configuration variable.Kevin McCarthy
$locale was only used to set the LC_TIME locale. Unfortunately, Mutt previously defaulted to using "C". This overrode the user's locale setting and forced them to re-specify their locale inside their .muttrc. Remove $locale and instead use the locale specified by the environment. Mutt still allows "C locale" dates by using a leading "!" in $date_format, ${}, etc. Another use of $locale was to customize attribution dates using hooks. The next commit will introduce $attribution_locale, which can be used for this instead. Thanks to Derek Martin for the original patch!
2016-07-30Add unread and total message count format strings to $folder_format.Kevin McCarthy
%n will show the unread message count in the mailbox. %m will show total message count. Except for %n with IMAP, these both require $mail_check_stats to be set, which puts these counts inside BUFFY. Since the imap_mboxcache is never fresher than the value in BUFFY, remove the special imap_mailbox_state() call. Instead, just update from the current Context for all mailboxes. Remove the logic that overrode the %N format string to show unread count for IMAP mailboxes. If they want to see unread count, they will have to change the $folder_format. Although it doesn't look possible to reuse browser_state.entry slots, change the OP_DELETE_MAILBOX to memset(0) the deleted slot. Then, we can change to logic in add_folder() so it doesn't need to zero-out unset values.
2016-06-17folder_file: remove struct statOlaf Hering
Add and use new flag to indicate the folder is on local filesystem. Add and use new gid, uid and nlink member. Use existing ->mode member instead of stat->st_mode. Use existing ->size member instead of stat->st_size. Use existing ->mtime member instead of stat->st_mtime. Remove struct stat, the used values were already duplicated in the struct. This reduces memory usage.
2016-05-09Change M_* symbols to MUTT_*Derek Martin
Changeset 23334e967dd7 created a workaround for a namespace conflict with Solaris and derivatives. After some discussion, the team decided it would be best to move away from using the "M_" prefix for macros. This patch was automatically generated by running: perl -wpi -e 's/\bM_(\w+)\b/MUTT_$1/g' `find . -name '*.[ch]' -print` with the exception that sys_socket.h was exempted. (That file will be backed out subsequent to this commit.) Thanks to Andras Salamon for supplying the perl script used to make this change.
2016-04-27Add cols parameter to mutt_FormatString()Kevin McCarthy
Continuing with the conversion to using windows for screen drawing, mutt_FormatString() was directly using COLS for right justification and similar formatting. Instead pass in a parameter, cols. This change involved seeding the parameter through callback functions too, as many of them call mutt_FormatString() back.
2016-01-01Update copyright notices.Kevin McCarthy
This patch only updates existing copyright notices in the source files, using commit dates since the last copyright update in commits e3af935cdb1a and f8fd60d8d3f2. Add a notice to the COPYRIGHT file to refer to our mercurial repository for the full commit history. Add myself to the COPYRIGHT file and smime_keys.pl file.
2015-10-04Create a separate macro/push/exec event buffer. (closes #3779)Kevin McCarthy
Currently, the SSL and TLS certficate prompts turn on OPTUNBUFFEREDINPUT, (to prevent macros and such from running right through the dialog). Unfortunately, the menu dialog processing in menu_dialog_dokey() is using mutt_ungetch() to forward non-dialog keys on to standard menu processing. With OPTUNBUFFEREDINPUT set, those keys never make it to the menu and are buffered until after the menu dialog. This patch creates a new event buffer, separate from the standard "unget" buffer, for use by macros, exec, and push events. These events can be temporarily ignored by setting OPTIGNOREMACROEVENTS (renamed from OPTUNBUFFEREDINPUT), while continuing to allow unget events to be processed. Since the "push" and "unget" functions now go to different buffers, function names were slightly renamed, to make it less easy to unintentionally use the wrong function at the wrong time.
2013-04-11backout c1371176ea45Michael Elkins