NeoMutt  2022-04-29-81-g9c5a59
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 321 of file command.c.

322 {
323  const char *name = NULL;
324 
326  {
328  if (name)
329  {
330  mutt_buffer_printf(buf, "compose %s", name);
331  return;
332  }
333  }
334 
335  name = mutt_map_get_name(cid, ColorFields);
336  if (name)
337  mutt_buffer_printf(buf, "%s", name);
338  else
339  mutt_buffer_printf(buf, "UNKNOWN %d", cid);
340 }
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
const struct Mapping ComposeColorFields[]
Mapping of compose colour names to their IDs.
Definition: command.c:98
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: