#include <wchar.h>
Go to the source code of this file.
Defines | |
| #define | FISH_COLOR_BOLD 0x80 |
| The value to send to set_color to tell it to use a bold font. | |
| #define | FISH_COLOR_UNDERLINE 0x100 |
| The value to send to set_color to tell it to underline the text. | |
| #define | writembs(mbs) |
| Write specified multibyte string. | |
Enumerations | |
| enum | { FISH_COLOR_BLACK, FISH_COLOR_RED, FISH_COLOR_GREEN, FISH_COLOR_YELLOW, FISH_COLOR_BLUE, FISH_COLOR_MAGENTA, FISH_COLOR_CYAN, FISH_COLOR_WHITE, FISH_COLOR_NORMAL, FISH_COLOR_IGNORE, FISH_COLOR_RESET } |
| Constants for various character classifications. More... | |
Functions | |
| void | set_color (int c, int c2) |
| Sets the fg and bg color. | |
| 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. | |
| int | writeb (tputs_arg_t b) |
| This is for writing process notification messages. | |
| 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 () |
| Return the current output writer. | |
| void | output_set_term (wchar_t *term) |
| Set the terminal name. | |
| wchar_t * | output_get_term () |
| Return the terminal name. | |
| #define writembs | ( | mbs | ) |
Value:
{ \
char *tmp = mbs; \
if( tmp ) \
{ \
writembs_internal( tmp ); \
} \
else \
{ \
debug( 0, \
_(L"Tried to use terminfo string %s on line %d of %s, which is undefined in terminal of type \"%ls\". Please report this error to %s"), \
#mbs, \
__LINE__, \
__FILE__, \
output_get_term(), \
PACKAGE_BUGREPORT); \
} \
}
Referenced by s_move(), s_write_mbs(), and set_color().
| anonymous enum |
| void output_set_writer | ( | int(*)(char) | writer | ) |
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.
References CHECK, out, and writer().
Referenced by s_move(), s_set_color(), s_write_char(), s_write_mbs(), and s_write_str().
| void set_color | ( | int | c, | |
| int | c2 | |||
| ) |
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.
| c | Foreground color. | |
| c2 | Background color. |
References FISH_COLOR_BOLD, FISH_COLOR_NORMAL, FISH_COLOR_UNDERLINE, and writembs.
Referenced by reader_interactive_destroy(), reader_readline(), reader_write_title(), s_set_color(), and term_donate().
| int writeb | ( | tputs_arg_t | b | ) |
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.
References out.
Referenced by format_job_info(), job_reap(), and writembs_internal().
| int writembs_internal | ( | char * | str | ) |
| void writestr_ellipsis | ( | const wchar_t * | str, | |
| int | max_width | |||
| ) |
Write a wide character string to FD 1.
If the string is wider than the specified maximum, truncate and ellipsize it.
References CHECK, ellipsis_char, my_wcswidth(), writech(), and writestr().
1.5.6