#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/termios.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#include <wctype.h>
#include <ncurses.h>
#include <termio.h>
#include <term.h>
#include <signal.h>
#include <fcntl.h>
#include <dirent.h>
#include <time.h>
#include <wchar.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "expand.h"
#include "common.h"
#include "output.h"
#include "halloc_util.h"
#include "highlight.h"
Defines | |
| #define | COLORS (sizeof(col)/sizeof(wchar_t *)) |
| Number of color names in the col array. | |
Functions | |
| static int | writeb_internal (char c) |
| Default output method, simply calls write() on stdout. | |
| static void | output_destroy () |
| Cleanup function. | |
| void | output_set_writer (int(*writer)(char)) |
| Set the function used for writing in move_cursor, writespace and set_color and all other output functions in this library. | |
| int(*)(char) | output_get_writer () |
| void | set_color (int c, int c2) |
| Sets the fg and bg color. | |
| int | writeb (tputs_arg_t b) |
| This is for writing process notification messages. | |
| int | writembs_internal (char *str) |
| Write a char * narrow string to FD 1, needed for the terminfo strings. | |
| int | writech (wint_t ch) |
| Write a wide character using the output method specified using output_set_writer(). | |
| void | writestr (const wchar_t *str) |
| Write a wide character string to FD 1. | |
| void | writestr_ellipsis (const wchar_t *str, int max_width) |
| Write a wide character string to FD 1. | |
| int | write_escaped_str (const wchar_t *str, int max_len) |
| Escape and write a string to fd 1. | |
| int | output_color_code (const wchar_t *val) |
| Return the internal color code representing the specified color. | |
| void | output_set_term (wchar_t *term) |
| wchar_t * | output_get_term () |
Variables | |
| static wchar_t * | col [] |
| Names of different colors. | |
| static int | col_idx [] |
| Mapping from color name (the 'col' array) to color index as used in ANSI color terminals, and also the fish_color_* constants defined in highlight.h. | |
| static size_t | writestr_buff_sz = 0 |
| Size of writestr_buff. | |
| static char * | writestr_buff = 0 |
| Temp buffer used for converting from wide to narrow strings. | |
| static int(* | out )(char c) = &writeb_internal |
| The function used for output. | |
| static wchar_t * | current_term = 0 |
|
|
Cleanup function. Run automatically through halloc |
|
|
Set the function used for writing in move_cursor, writespace and set_color and all other output functions in this library. By default, the write call is used to give completely unbuffered output to stdout. |
|
||||||||||||
|
Sets the fg and bg color. May be called as often as you like, since if the new color is the same as the previous, nothing will be written. Negative values for set_color will also be ignored. Since the terminfo string this function emits can potentially cause the screen to flicker, the function takes care to write as little as possible. Possible values for color are any form the FISH_COLOR_* enum, FISH_COLOR_IGNORE and FISH_COLOR_RESET. FISH_COLOR_IGNORE will leave the color unchanged, and FISH_COLOR_RESET will perform an exit_attribute_mode, even if set_color thinks it is already in FISH_COLOR_NORMAL mode. In order to set the color to normal, three terminfo strings may have to be written.
|
|
|
This is for writing process notification messages. Has to write to stdout, so clr_eol and such functions will work correctly. Not an issue since this function is only used in interactive mode anyway. |
|
|
Write a char * narrow string to FD 1, needed for the terminfo strings. This is usually just a wrapper aound tputs, using writeb as the sending function. But a weird bug on PPC Linux means that on this platform, write is instead used directly. |
|
||||||||||||
|
Write a wide character string to FD 1. If the string is wider than the specified maximum, truncate and ellipsize it. |
|
|
Initial value:
{
L"black",
L"red",
L"green",
L"brown",
L"yellow",
L"blue",
L"magenta",
L"purple",
L"cyan",
L"white"
L"normal"
}
|
|
|
Initial value:
{
0,
1,
2,
3,
3,
4,
5,
5,
6,
7,
FISH_COLOR_NORMAL,
}
Non-ANSI terminals will display the wrong colors, since they use a different mapping. |
1.4.4