2016-05-02 05:29:21 +00: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-04 15:11:39 +00:00
|
|
|
#ifndef FISH_OUTPUT_H
|
|
|
|
#define FISH_OUTPUT_H
|
|
|
|
|
2016-05-02 05:29:21 +00:00
|
|
|
#include <stddef.h>
|
2017-02-14 04:37:27 +00:00
|
|
|
|
2016-05-02 05:29:21 +00:00
|
|
|
#include <vector>
|
2016-04-21 06:00:54 +00:00
|
|
|
|
2016-05-02 05:29:21 +00:00
|
|
|
#include "color.h"
|
2016-04-21 06:00:54 +00:00
|
|
|
#include "fallback.h" // IWYU pragma: keep
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2017-08-05 22:08:39 +00:00
|
|
|
class env_var_t;
|
|
|
|
|
2012-02-12 01:07:56 +00:00
|
|
|
void set_color(rgb_color_t c, rgb_color_t c2);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2018-12-12 10:39:37 +00:00
|
|
|
void writembs_check(const char *mbs, const char *mbs_name, bool critical, const char *file, long line);
|
2018-06-18 01:59:34 +00: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 13:26:39 +00:00
|
|
|
|
2012-11-19 00:30:30 +00:00
|
|
|
int writech(wint_t ch);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2012-11-19 00:30:30 +00:00
|
|
|
void writestr(const wchar_t *str);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2017-08-06 04:40:27 +00:00
|
|
|
rgb_color_t parse_color(const env_var_t &val, bool is_background);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2012-11-19 00:30:30 +00:00
|
|
|
int writeb(tputs_arg_t b);
|
2006-02-16 13:40:25 +00:00
|
|
|
|
2012-11-19 00:30:30 +00:00
|
|
|
void output_set_writer(int (*writer)(char));
|
2006-02-16 13:40:25 +00:00
|
|
|
|
2016-05-02 05:29:21 +00:00
|
|
|
int (*output_get_writer())(char);
|
2006-10-01 16:02:58 +00:00
|
|
|
|
2016-05-02 05:29:21 +00:00
|
|
|
/// Sets what colors are supported.
|
|
|
|
enum { color_support_term256 = 1 << 0, color_support_term24bit = 1 << 1 };
|
2014-09-19 22:37:31 +00: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 17:52:17 +00:00
|
|
|
|
2014-11-10 00:42:35 +00:00
|
|
|
rgb_color_t best_color(const std::vector<rgb_color_t> &colors, color_support_t support);
|
|
|
|
|
2016-07-23 20:40:01 +00:00
|
|
|
bool write_color(rgb_color_t color, bool is_fg);
|
2013-02-14 23:50:24 +00:00
|
|
|
unsigned char index_for_color(rgb_color_t c);
|
|
|
|
|
2005-10-04 15:11:39 +00:00
|
|
|
#endif
|