NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
ansi.h File Reference

ANSI Colours. More...

#include <stdbool.h>
#include "attr.h"
Include dependency graph for ansi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  AnsiColor
 An ANSI escape sequence. More...

Functions

int ansi_color_parse (const char *str, struct AnsiColor *ansi, struct AttrColorList *acl, bool dry_run)
 Parse a string of ANSI escape sequence.

Detailed Description

ANSI Colours.

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 ansi.h.

Function Documentation

◆ ansi_color_parse()

int ansi_color_parse ( const char * str,
struct AnsiColor * ansi,
struct AttrColorList * acl,
bool dry_run )

Parse a string of ANSI escape sequence.

Parameters
strString to parse
ansiAnsiColor for the result
aclList to store the unique colours
dry_runIf true, parse but don't save the sequence
Return values
numTotal length of the escape sequences

Parse (multiple) ANSI sequence(s) into ansi. If the colour hasn't been seen before, store the it in acl.

Definition at line 120 of file ansi.c.

122{
123 int seq_len = 0;
124 int total_len = 0;
125
126 while ((seq_len = ansi_color_parse_single(str + total_len, ansi, dry_run)) != 0)
127 {
128 total_len += seq_len;
129 }
130
131 ansi_color_list_add(acl, ansi);
132
133 return total_len;
134}
static void ansi_color_list_add(struct AttrColorList *acl, struct AnsiColor *ansi)
Add an Ansi colour to the list.
Definition ansi.c:49
int ansi_color_parse_single(const char *buf, struct AnsiColor *ansi, bool dry_run)
Parse a single ANSI escape sequence.
Definition parse_ansi.c:108
Here is the call graph for this function:
Here is the caller graph for this function: