2016-05-01 22:29:21 -07:00
|
|
|
// Generic output functions.
|
|
|
|
//
|
|
|
|
// Constants for various character classifications. Each character of a command string can be
|
|
|
|
// classified as one of the following types.
|
2005-10-05 01:11:39 +10:00
|
|
|
#ifndef FISH_OUTPUT_H
|
|
|
|
#define FISH_OUTPUT_H
|
|
|
|
|
2016-05-01 22:29:21 -07:00
|
|
|
#include <stddef.h>
|
2017-02-13 20:37:27 -08:00
|
|
|
|
2016-05-01 22:29:21 -07:00
|
|
|
#include <vector>
|
2016-04-20 23:00:54 -07:00
|
|
|
|
2016-05-01 22:29:21 -07:00
|
|
|
#include "color.h"
|
2016-04-20 23:00:54 -07:00
|
|
|
#include "fallback.h" // IWYU pragma: keep
|
2005-10-05 01:11:39 +10:00
|
|
|
|
2017-08-05 15:08:39 -07:00
|
|
|
class env_var_t;
|
|
|
|
|
2012-02-11 17:07:56 -08:00
|
|
|
void set_color(rgb_color_t c, rgb_color_t c2);
|
2005-09-20 23:26:39 +10:00
|
|
|
|
2018-12-12 11:39:37 +01:00
|
|
|
void writembs_check(const char *mbs, const char *mbs_name, bool critical, const char *file, long line);
|
2018-06-17 20:59:34 -05:00
|
|
|
#define writembs(mbs) writembs_check((mbs), #mbs, true, __FILE__, __LINE__)
|
|
|
|
#define writembs_nofail(mbs) writembs_check((mbs), #mbs, false, __FILE__, __LINE__)
|
2005-09-20 23:26:39 +10:00
|
|
|
|
2012-11-18 16:30:30 -08:00
|
|
|
int writech(wint_t ch);
|
2005-09-20 23:26:39 +10:00
|
|
|
|
2012-11-18 16:30:30 -08:00
|
|
|
void writestr(const wchar_t *str);
|
2005-09-20 23:26:39 +10:00
|
|
|
|
2017-08-05 21:40:27 -07:00
|
|
|
rgb_color_t parse_color(const env_var_t &val, bool is_background);
|
2005-09-20 23:26:39 +10:00
|
|
|
|
2012-11-18 16:30:30 -08:00
|
|
|
int writeb(tputs_arg_t b);
|
2006-02-16 23:40:25 +10:00
|
|
|
|
2012-11-18 16:30:30 -08:00
|
|
|
void output_set_writer(int (*writer)(char));
|
2006-02-16 23:40:25 +10:00
|
|
|
|
2016-05-01 22:29:21 -07:00
|
|
|
int (*output_get_writer())(char);
|
2006-10-02 02:02:58 +10:00
|
|
|
|
2016-05-01 22:29:21 -07:00
|
|
|
/// Sets what colors are supported.
|
|
|
|
enum { color_support_term256 = 1 << 0, color_support_term24bit = 1 << 1 };
|
2014-09-19 15:37:31 -07:00
|
|
|
typedef unsigned int color_support_t;
|
|
|
|
color_support_t output_get_color_support();
|
|
|
|
void output_set_color_support(color_support_t support);
|
2012-02-13 09:52:17 -08:00
|
|
|
|
2014-11-09 16:42:35 -08:00
|
|
|
rgb_color_t best_color(const std::vector<rgb_color_t> &colors, color_support_t support);
|
|
|
|
|
2016-07-23 13:40:01 -07:00
|
|
|
bool write_color(rgb_color_t color, bool is_fg);
|
2013-02-14 15:50:24 -08:00
|
|
|
unsigned char index_for_color(rgb_color_t c);
|
|
|
|
|
2005-10-05 01:11:39 +10:00
|
|
|
#endif
|