forked from PsychoticNinja/irssi
Add common IS_PRINTABLE macro.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4474 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
b8380772e2
commit
7c84b6fc2e
@ -232,7 +232,7 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos)
|
|||||||
|
|
||||||
if (entry->hidden)
|
if (entry->hidden)
|
||||||
term_addch(root_window, ' ');
|
term_addch(root_window, ' ');
|
||||||
else if (*p >= 32 && (*p < 0x7F || *p > 0x9F))
|
else if (IS_PRINTABLE(*p))
|
||||||
term_add_unichar(root_window, *p);
|
term_add_unichar(root_window, *p);
|
||||||
else {
|
else {
|
||||||
term_set_color(root_window, ATTR_RESET|ATTR_REVERSE);
|
term_set_color(root_window, ATTR_RESET|ATTR_REVERSE);
|
||||||
|
@ -661,9 +661,7 @@ static char *reverse_controls(const char *str)
|
|||||||
out = g_string_new(NULL);
|
out = g_string_new(NULL);
|
||||||
|
|
||||||
while (*str != '\0') {
|
while (*str != '\0') {
|
||||||
if ((unsigned char) *str < 32 ||
|
if (!IS_PRINTABLE((unsigned char) *str)) {
|
||||||
(term_type == TERM_TYPE_8BIT &&
|
|
||||||
(unsigned char) (*str & 0x7f) < 32)) {
|
|
||||||
/* control char */
|
/* control char */
|
||||||
g_string_sprintfa(out, "%%8%c%%8",
|
g_string_sprintfa(out, "%%8%c%%8",
|
||||||
'A'-1 + (*str & 0x7f));
|
'A'-1 + (*str & 0x7f));
|
||||||
|
@ -22,6 +22,8 @@ typedef struct _TERM_WINDOW TERM_WINDOW;
|
|||||||
|
|
||||||
typedef guint32 unichar;
|
typedef guint32 unichar;
|
||||||
|
|
||||||
|
#define IS_PRINTABLE(c) (((c) & ~0x80) >= 32)
|
||||||
|
|
||||||
extern TERM_WINDOW *root_window;
|
extern TERM_WINDOW *root_window;
|
||||||
extern int term_width, term_height;
|
extern int term_width, term_height;
|
||||||
extern int term_use_colors, term_type, term_detached;
|
extern int term_use_colors, term_type, term_detached;
|
||||||
|
@ -451,7 +451,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
|
|||||||
|
|
||||||
xpos += char_width;
|
xpos += char_width;
|
||||||
if (xpos <= term_width) {
|
if (xpos <= term_width) {
|
||||||
if ((chr & ~0x80) >= 32) {
|
if (IS_PRINTABLE(chr)) {
|
||||||
for (; text < end; text++)
|
for (; text < end; text++)
|
||||||
term_addch(view->window, *text);
|
term_addch(view->window, *text);
|
||||||
term_addch(view->window, *text);
|
term_addch(view->window, *text);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user