Skip to content

Instantly share code, notes, and snippets.

@flatcap
Last active September 17, 2018 20:54
Show Gist options
  • Save flatcap/b118c87aeef0bc1766c95fd93e7f205b to your computer and use it in GitHub Desktop.
Save flatcap/b118c87aeef0bc1766c95fd93e7f205b to your computer and use it in GitHub Desktop.
Medium Tasks

Style Menu Options

Looking for something easier? (try these)

Description

When NeoMutt asks a question, the menu options are usually given with parenthesised letters or "number-colon", e.g.

  • (R)eject, accept (O)nce, (A)ccept always, (S)kip
  • 1: RC2-40, 2: RC2-64, 3: RC2-128

Add a 'color' object to allow the user to style (color) the menu, e.g.

  • Reject, accept Once, Accept always, Skip
  • 1 RC2-40, 2 RC2-64, 3 RC2-128

Part 1: Create a color object for menu options

Create two color objects, one for the base message and one for the highlighed option character.

Part 2: Style the menu options

Change the display of menus to use the colors and hide the parentheses or colon.

If the option color isn't set, then the message shouldn't be abbreviated.

Encapsulate the Progress Bar

Looking for something easier? (try these)

Description

Wrap up the code for the Progress Bar, reducing the effort for the callers and unify the logging of progress events.

Part 1: Review Logging Levels

There are currently 5 debug logging levels, which aren't used consistently. The new guideline is:

  • Level 1-3: General debug info (at the programmer's discretion)
  • Level 4: Progress bar, trace info, e.g. "Entering function()"
  • Level 5: Data read/written/transferred, or other private info

There are about 65 calls to mutt_debug() which need reviewing. This shouldn't take too long. For each message decide whether it should be:

  • Level 3: General
  • Level 4: Progress
  • Level 5: Data

Part 2: Create a LL_PROGRESS Log Level

Create a new debugging level LL_PROGRESS and change the progress bar to use it.

You'll need to alter the logging code, too. Progress messages should always be displayed on screen, but only be written to file if $debug_level >= 4.

Now run neomutt -d3 with some large folders, etc, and find any other progess messages that should have their level altered.

Try some large searches, too.

Part 3: Encapsulate the Progress Bar

Change the code to dynamically create() and destroy() the Progress object. This will allow the progress bar to signal when it's done.

Currently, the code is littered with calls to mutt_window_clearline() many of which only exist to clear away the last progress message.

Future direction

(This isn't required for this issue)

The update frequency for the progress bar is controlled by:

  • net_inc
  • read_inc
  • time_inc
  • write_inc

It would make sense for this to be handled by the progess bar itself.

Relative Source Files

Looking for something easier? (try these)

Description

NeoMutt's source command works relative to the file it's in. Extend this behaviour to four more config variables:

  • alias_file
  • certificate_file
  • history_file
  • ssl_ca_certificates_file

Part 1: Make them relative

We should store the absolute path for these files.

If they're specified as relative paths, then expand them using

  • Current config file's location (if reading from a config file)
  • Current working directory of NeoMutt (if the user enters a command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment