NeoMutt  2022-04-29-215-gc12b98
Teaching an old dog new tricks
DOXYGEN
command2.h File Reference

Parse colour commands. More...

#include "config.h"
#include <stdint.h>
#include "core/lib.h"
+ Include dependency graph for command2.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* parser_callback_t) (struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
 

Functions

enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'color' command - Implements Command::parse() -. More...
 
enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'mono' command - Implements Command::parse() -. More...
 
enum CommandResult mutt_parse_uncolor (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'uncolor' command - Implements Command::parse() -. More...
 
enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unmono' command - Implements Command::parse() -. More...
 
void get_colorid_name (unsigned int color_id, struct Buffer *buf)
 Get the name of a color id. More...
 

Detailed Description

Parse colour commands.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file command2.h.

Typedef Documentation

◆ parser_callback_t

typedef int(* parser_callback_t) (struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)

Definition at line 46 of file command2.h.

Function Documentation

◆ get_colorid_name()

void get_colorid_name ( unsigned int  cid,
struct Buffer buf 
)

Get the name of a color id.

Parameters
cidColour, e.g. MT_COLOR_HEADER
bufBuffer for result

Definition at line 329 of file command.c.

330{
331 const char *name = NULL;
332
334 {
336 if (name)
337 {
338 mutt_buffer_printf(buf, "compose %s", name);
339 return;
340 }
341 }
342
343 name = mutt_map_get_name(cid, ColorFields);
344 if (name)
345 mutt_buffer_printf(buf, "%s", name);
346 else
347 mutt_buffer_printf(buf, "UNKNOWN %d", cid);
348}
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
const struct Mapping ComposeColorFields[]
Mapping of compose colour names to their IDs.
Definition: command.c:99
const struct Mapping ColorFields[]
Mapping of colour names to their IDs.
Definition: command.c:45
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:45
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:41
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function: