summaryrefslogtreecommitdiffstats
path: root/menu.c
AgeCommit message (Collapse)Author
2022-11-04Add explicit void to 0-parameter function definitions.Kevin McCarthy
These are the errors output with: -Werror=implicit-int -Werror=implicit-function-declaration -Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition
2022-10-08Move SigWinch handling before refresh in menus.Kevin McCarthy
This will prevent an unneeded double-refresh after an endwin() when we set SigWinch in the next commit. In the pager, change RETWINCH handling to account for a sigwinch while in the handler. Previously a redraw would occur and use/free the Resize data, but since the SigWinch check now occurs before the redraw, keep existing data.
2021-12-28Add pager REDRAW_FLOW redraw flag when popping a menu.Kevin McCarthy
A setting change or window resize could take place in the called menu, which will require reflowing the pager when returning to it. When converting to the menu stack, I left in manual REDRAW_FULL redraw assignments, to be cautious and because it wasn't causing an problems. However, with the REDRAW_FLOW added, the pager menu needs to have those assignments removed after a menu call.
2021-06-19Fix menu.c sigwinch handling order.Kevin McCarthy
This fixes problems with a sigwinch that occurs during an external process, such as during a query menu lookup, or after exiting the background-edit landing page. Without this change, the user would see a misdrawn screen and would need to press a key first. Change it so that the SigWinch flag is handled before reading input, so that the page is automatically redrawn. This matches the behavior in the index, pager, and background-edit process list menu.
2021-04-15Use bkgrndset() as ATTRSET() backend if available.Kevin McCarthy
This function allows more usable color pairs, because it passes the pair parameter separately. The COLOR_PAIR() macro only returns 8-bits for a pair, limiting the total pairs used to 256 despite many systems having much larger COLOR_PAIRS values. In order to do this, separate out the pair and attrs values, instead of combining attr + COLOR_PAIR(pair) into a single value and storing that inside Mutt. For the older calls, bkgdset() and attrset(), we call COLOR_PAIR() at the last minute. Add COLOR_ATTR to header cache sum calculation, since it is used in the HEADER now.
2021-01-27Convert all mutt_atoX functions to behave strictly.Kevin McCarthy
* Remove the automatic conversion of NULL and '\0' to 0. Add a flag for the cases that require lax evaluation. * Make trailing characters generate an error by default for the mutt_atouX functions. Add a flag for that case. Most of the IMAP code parses numbers out of a stream, so add the flag to those calls. * The mutt_atouX functions were also behaving incorrectly with invalid input, e.g. "ABC", returning and setting 0. Fix them to return an error in those cases. * Add a mutt_atoll() function, to be used in the next commit. * Change converters to store 0 on error. atos, atoi, and atoui were already doing this, but the others were not.
2020-07-22Fix redraw_motion() redraw bug.Kevin McCarthy
Commit e2a28006 moved the cur_color assignment so that $arrow_cursor could also use the value for overlays. Unfortunately, it at the same time moved the call *after* the call to mutt_window_move(), which would introduce a drawing bug if menu->color() went across IMAP. The previous commit removed overlays for $arrow_cursor, also removing the need for cur_color to be assigned for both. Move it back to where it was before.
2020-07-22Add color overlay to print_enriched_string().Maxim Tarasov
It is called by main menu drawing routines and contains its own conditional coloring of a tree component. As is, everything in there gets overwritten by the indicator. Furthermore, do_color parameter specifically disables any coloring in order for indicator highlight to overwrite everything else. We need to merge three colors here: 1) index color; 2) tree color, that is drawn within menu using its own color; 3) indicator color, that, if active, is drawn over both of them. Combining these colors is implemented in that order. After some testing, I think it doesn't make sense to merge colors when $arrow_cursor is on. This part is reverted to the original behavior. Make print_enriched_string() coloring behavior self-contained, instead of assuming the proper base_color is already set. This makes the callers simpler and allows them to only handle $arrow_cursor logic.
2020-07-20Add $cursor_overlay, default unset, to control overlaying.Kevin McCarthy
Although I think the new behavior is desirable, experience has shown that changes need to be controlled by an option and usually defaulting the same as before.
2020-07-20Add cursor overlay capability.Maxim Tarasov
Currently, when the indicator line is over an unread message, full indicator color definition is used, and the line is no longer displayed bold. It's harder to notice when using default reverse style for the indicator, but it becomes much more prominent when you have black on white display and only subtle change in the indicator background. We could improve this by merging indicator color definition with color definition of the underlying menu item. Here is how it's done: 1. First color definitions for the indicator and underlying menu item are taken and split back to foreground, background and attributes (meaning bold, underline, etc.). 2. If indicator does not specify foreground or background color, new color pair is created by using underlying menu item as base. Else indicator's own foreground and background are used (current behavior). 3. Then attributes of both colors are combined together. For example, if indicator has 'underline' and menu item has 'bold' result will be highlighted as 'bold underline'. 4. The resulting color is used in place of MT_COLOR_INDICATOR when highlighting things in menu.c. Combining attributes this way makes sense to me, because indicator is meant to _indicate_, meaning increasing information density. It also looks better when moving through the list containing differently styled items. This patch affects indicator, sidebar_highlight, and sidebar_indicator color objects.
2020-02-29Add background compose menu and $background_format config var.Kevin McCarthy
List the backgrounded sessions. Allow the user to resume one, or exit the menu. Bind to 'B' by default in the index and pager menus. Remove the "<mail>" function autoresuming functionality, instead invoke the menu to resume backgrounded sessions.
2019-12-21Turn off auto-clear outside of autocrypt initialization.Kevin McCarthy
The auto-clearing code was added in commit 01bc088c, for autocrypt initial prompting. It removed having to keep track of every place a browser or other menu might be displayed and having to remember to clear it out. However, clearing when mutt exits is a change of behavior for those who have turned off alternative screens.
2019-11-08Fix sigwinch race in the index and menu processor.Kevin McCarthy
Reset the SigWinch flag before the screen resize/reflow, not afterwards.
2019-08-07Automatically clear screen when popping the last menu.Kevin McCarthy
This removes the need to manually clear the screen during pre-menu operations, such as autocrypt first run initialization.
2019-04-19Add menu dialog helper to add rows.Kevin McCarthy
Remove the manual max calculation and dialog row allocation. Add a NONULL check because the helper uses safe_strdup() to add a row.
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-06-28Add check-stats function to calculate mailbox statistics.Anton Lindqvist
This allows the statistics to be updated without setting $mail_check_stats or before $mail_check_stats_interval has passed.
2018-06-03Change direct mutt_getch() callers to handle new mail event.Kevin McCarthy
The inotify handler now returns -2 (timeout) on a new mail event. Change the direct callers to ignore, so prompts aren't strangely aborted. Also, fix mutt_change_flag() to call mutt_refresh() before the prompt. Apparently ncurses getch() was doing this for us, but now that we are polling STDIN instead, the prompt wasn't displaying.
2018-04-22Add Error History function and config var.Kevin McCarthy
<error-history>, by default unbound, shows a list of the recent error messages displayed by Mutt via mutt_message() or mutt_error(). $error_history sets the size of the history ring. For now, I've decided to include mutt_message() messages too. If this is too chatty, we can restrict it to mutt_error() easily in the future.
2017-07-19merge stableKevin McCarthy
2017-07-19Fix menu color calls to occur before positioning the cursor. (see #3956)Kevin McCarthy
It is possible for menu->color() to end up fetching an imap message, and therefore generating a status message. Because of this, we need to make those calls before we position the cursor.
2017-06-01Fix tag-prefix to not abort on $timeout.Kevin McCarthy
If $timeout is set very low, then it can cancel the tag-prefix before the user has time to press the desired command. Change the code to set the tag flag, and then recontinue with normal event processing instead. Cancel on an abort, but continue with a timeout. Thanks to Lauri Tirkkonen for reporting the issue.
2017-06-01Change km_dokey() to return -2 on a timeout/sigwinch.Kevin McCarthy
In some cases, such as tag-prefix or _mutt_enter_string(), it is desirable to be able to distinguish between a timeout/sigwinch event and an input error/abort/ctrl-g.
2017-05-09Create R_PAGER_FLOW config variable flag.Kevin McCarthy
Use this for $header_color_partial, $markers, and $smart_wrap. When these options are changed in the pager, this flag will force a recalculation of lineInfo. Remove the manual checks in OP_ENTER_COMMAND for $markers and $smart_wrap, and instead use the same REDRAW_FLOW processing used for a SigWinch.
2017-05-05Change message modifying operations to additively set redraw flags.Kevin McCarthy
With the ability to set redraw flags with the menu stack operations, some operations internally modify the current menu redraw flag. For instance, _mutt_set_flag() can now set REDRAW_SIDEBAR. Change the ops that modify messages to use 'redraw |= REDRAW_X' instead of overwriting the flag value.
2017-04-05Separate out the compose menu redrawing. (see #3877)Kevin McCarthy
Add a custom_menu_redraw to the menu and change menu_redraw() to call that instead if set.
2017-04-05Change km_dokey() to pass SigWinch on for the MENU_EDITOR. (see #3877)Kevin McCarthy
Change _mutt_enter_string() to pass the SigWinch through for _mutt_get_field() or mutt_enter_string() to handle. Add a call to mutt_current_menu() in _mutt_get_field() to properly redisplay the screen in that case.
2017-03-31Remove SidebarNeedsRedraw.Kevin McCarthy
The menu stack can be used to flag a redraw of the sidebar window.
2017-03-31Remove the OPTFORCEREDRAW options.Kevin McCarthy
Use the menu stack to flag redraws for the index and pager.
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-26Change CurrentMenu to be controlled by the menu stack.Kevin McCarthy
The pager menu is a bit tricky with respect to the menu->menu and CurrentMenu, so add a few comments.
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.
2016-06-04Add "mutt_" prefix to global sidebar functions.Kevin McCarthy
Also, remove unused sb_init declaration.
2016-06-04Sidebar clean up: building and drawing logic.Kevin McCarthy
Fix the autoconf/makefile.am changes to be consistent. Create a global SidebarNeedsRedraw to indicate a redraw is needed, instead of putting sb_draw() everywhere in the code. Create a menu_redraw_sidebar() function and use the REDRAW_SIDEBAR flag instead of piggy-backing it inside the index loop. Fix curs_main.c and pager.c to be a bit cleaner by using the global and REDRAW_SIDEBAR. Start to clean up some of the buffy code, but this needs to refactored and fixed.
2016-06-04Add neomutt version of sidebar patch. (closes #3829)Richard Russon
This is the patch from neomutt; branch 'devel/win-sidebar'; commit c796fa85f9cacefb69b8f7d8545fc9ba71674180 with the following changes: - move the sample muttrc and vimrc to contrib. - remove the README.sidebar. - empty out the PATCHES file.
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-27Modify the menu code to use windows.Kevin McCarthy
Change menu.c to use the mutt_window_t structures and functions. The index/stats/help/message window pointers are stored inside the menu_t. This is useful for the pager, where the "index" we want to use is a mini-index.
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.
2015-10-04Fix menu type in certificate prompt. (see #3779)Kevin McCarthy
The menu type is used in several places as a direct index into Keymaps[], so passing in -1 to mutt_new_menu() was leading to illegal memory accesses later on. Add a range check in mutt_new_menu(), defaulting to MENU_GENERIC, to prevent this problem in the future.
2012-12-30make the SETCOLOR() macro use bkgdset() on systems which have it, and ↵Michael Elkins
attrset() when we don't. closes #3005
2012-12-20remove redundant #include statementsMichael Elkins
2012-12-20remove extern decl for Charset_is_utf8 since menu.c includes mbyte.h which ↵Michael Elkins
has the same decl.
2012-12-19use WACS_* macros for printing wide versions of the line drawing characters ↵Michael Elkins
when linking against ncursesw. This patch is based on http://prefix.gentooexperimental.org:8000/mutt-patches/file/fea851a2808f/solaris-ncurses-chars.patch
2010-08-24Do not call regfree if regcomp fails.Emanuele Giaquinta
The content of the regex_t structure is undefined in this case.
2009-06-01Use strtol() wrappers for most atoi() callsRocco Rutte
2009-05-29Fall back to search if no query exists for search-(next|opposite)Rocco Rutte
The pager had the fall-through to search, so for consistency do that in other menues as well.
2009-01-04Update copyrights. Closes #3016.Brendan Cully
I went through the logs of each file with a copyright header and updated the years for the authors in the headers for any non-comment changes they introduced. What a pain!
2008-11-30Manage last search pattern outside of menu lifecycleRocco Rutte
Previously, the pattern was thrown away during menu destruction. For the next search, mutt then can't provide a good suggestion. The new behaviour is to manage the pattern outside the lifecyle to always provide the last pattern as suggestion.
2008-10-28Make some functions static.Emanuele Giaquinta