NeoMutt  2024-04-16-36-g75b6fb
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 118 of file ansi.c.

120{
121 int seq_len = 0;
122 int total_len = 0;
123
124 while ((seq_len = ansi_color_parse_single(str + total_len, ansi, dry_run)) != 0)
125 {
126 total_len += seq_len;
127 }
128
129 ansi_color_list_add(acl, ansi);
130
131 return total_len;
132}
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:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function: