Parse ANSI Sequences. More...
#include "config.h"
#include <ctype.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "parse_ansi.h"
#include "ansi.h"
#include "attr.h"
#include "color.h"
Go to the source code of this file.
Functions | |
void | ansi_color_reset (struct AnsiColor *ansi) |
Reset an AnsiColor to uncoloured. | |
static bool | ansi_is_end_char (char c) |
Is this the end of a sequence? | |
int | ansi_color_seq_length (const char *str) |
Is this an ANSI escape sequence? | |
int | ansi_color_parse_single (const char *buf, struct AnsiColor *ansi, bool dry_run) |
Parse a single ANSI escape sequence. | |
Parse ANSI Sequences.
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 parse_ansi.c.
void ansi_color_reset | ( | struct AnsiColor * | ansi | ) |
Reset an AnsiColor to uncoloured.
ansi | AnsiColor to reset |
Definition at line 45 of file parse_ansi.c.
|
inlinestatic |
Is this the end of a sequence?
c | Character to test |
true | Is it a valid end char |
Definition at line 65 of file parse_ansi.c.
int ansi_color_seq_length | ( | const char * | str | ) |
Is this an ANSI escape sequence?
str | String to test |
0 | No, not an ANSI sequence |
>0 | Length of the ANSI sequence |
Match ANSI escape sequences of type 'm', e.g.
<esc>[1;32m
Definition at line 79 of file parse_ansi.c.
int ansi_color_parse_single | ( | const char * | buf, |
struct AnsiColor * | ansi, | ||
bool | dry_run | ||
) |
Parse a single ANSI escape sequence.
buf | String to parse |
ansi | AnsiColor for the result |
dry_run | Don't parse anything, just skip over |
num | Length of the escape sequence |
Parse an ANSI escape sequence into ansi. Calling this function repeatedly, will accumulate sequences in ansi.
Definition at line 109 of file parse_ansi.c.