mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
All control chars in statusbar items are now displayed reversed.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2574 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
bcb79f5030
commit
1528cfc9d7
@ -653,6 +653,32 @@ const char *statusbar_item_get_value(SBAR_ITEM_REC *item)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *reverse_controls(const char *str)
|
||||||
|
{
|
||||||
|
GString *out;
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
out = g_string_new(NULL);
|
||||||
|
|
||||||
|
while (*str != '\0') {
|
||||||
|
if ((unsigned char) *str < 32 ||
|
||||||
|
(term_type == TERM_TYPE_8BIT &&
|
||||||
|
(unsigned char) (*str & 0x7f) < 32)) {
|
||||||
|
/* control char */
|
||||||
|
g_string_sprintfa(out, "%%8%c%%8",
|
||||||
|
'A'-1 + (*str & 0x7f));
|
||||||
|
} else {
|
||||||
|
g_string_append_c(out, *str);
|
||||||
|
}
|
||||||
|
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = out->str;
|
||||||
|
g_string_free(out, FALSE);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only,
|
void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only,
|
||||||
const char *str, const char *data,
|
const char *str, const char *data,
|
||||||
int escape_vars)
|
int escape_vars)
|
||||||
@ -693,6 +719,11 @@ void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only,
|
|||||||
tmpstr = strip_codes(tmpstr2);
|
tmpstr = strip_codes(tmpstr2);
|
||||||
g_free(tmpstr2);
|
g_free(tmpstr2);
|
||||||
|
|
||||||
|
/* show all control chars reversed */
|
||||||
|
tmpstr2 = reverse_controls(tmpstr);
|
||||||
|
g_free(tmpstr);
|
||||||
|
|
||||||
|
tmpstr = tmpstr2;
|
||||||
if (get_size_only) {
|
if (get_size_only) {
|
||||||
item->min_size = item->max_size = format_get_length(tmpstr);
|
item->min_size = item->max_size = format_get_length(tmpstr);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user