degesch: fix some encoding issues

This commit is contained in:
Přemysl Eric Janouch 2015-07-15 22:59:55 +02:00
parent b257340ad2
commit bcbbdbc4bc
1 changed files with 10 additions and 6 deletions

View File

@ -2959,8 +2959,11 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer)
{
// The prompt can take considerable time to redraw
input_hide (&ctx->input);
// FIXME: encoding
print_status ("%s", buffer->name);
char *buffer_name_localized =
iconv_xstrdup (ctx->term_from_utf8, buffer->name, -1, NULL);
print_status ("%s", buffer_name_localized);
free (buffer_name_localized);
// That is, minus the buffer switch line and the readline prompt
int display_limit = MAX (MAX (10,
@ -4519,21 +4522,22 @@ refresh_prompt (struct app_context *ctx)
str_init (&prompt);
make_prompt (ctx, &prompt);
str_append_c (&prompt, ' ');
char *localized = iconv_xstrdup (ctx->term_from_utf8, prompt.str, -1, NULL);
str_free (&prompt);
// FIXME: encoding
if (have_attributes)
{
// XXX: to be completely correct, we should use tputs, but we cannot
input_set_prompt (&ctx->input, xstrdup_printf ("%c%s%c%s%c%s%c",
INPUT_START_IGNORE, ctx->attrs[ATTR_PROMPT],
INPUT_END_IGNORE,
prompt.str,
localized,
INPUT_START_IGNORE, ctx->attrs[ATTR_RESET],
INPUT_END_IGNORE));
free (localized);
}
else
input_set_prompt (&ctx->input, xstrdup (prompt.str));
str_free (&prompt);
input_set_prompt (&ctx->input, localized);
}
// --- Helpers -----------------------------------------------------------------