degesch: enhance the prompt

- prepend the buffer's index
 - don't show modes if they're empty
 - don't show the nick in the global buffer
This commit is contained in:
Přemysl Eric Janouch 2015-04-16 21:26:47 +02:00
parent 75b2fc1da2
commit 2d4adaefbf

View File

@ -1291,13 +1291,22 @@ refresh_prompt (struct app_context *ctx)
str_append_printf (&prompt, "(%s) ", unseen_prefix); str_append_printf (&prompt, "(%s) ", unseen_prefix);
free (unseen_prefix); free (unseen_prefix);
str_append (&prompt, buffer->name); int buffer_index = 1;
if (buffer->type == BUFFER_CHANNEL) for (struct buffer *iter = ctx->buffers;
str_append_printf (&prompt, "(%s)", buffer->mode); iter && iter != buffer; iter = iter->next)
str_append_c (&prompt, ' '); buffer_index++;
str_append (&prompt, ctx->irc_nickname); str_append_printf (&prompt, "%d:%s", buffer_index, buffer->name);
str_append_printf (&prompt, "(%s)", ctx->irc_user_mode); if (buffer->type == BUFFER_CHANNEL && *buffer->mode)
str_append_printf (&prompt, "(%s)", buffer->mode);
if (buffer != ctx->global_buffer)
{
str_append_c (&prompt, ' ');
str_append (&prompt, ctx->irc_nickname);
if (*ctx->irc_user_mode)
str_append_printf (&prompt, "(%s)", ctx->irc_user_mode);
}
str_append_c (&prompt, ']'); str_append_c (&prompt, ']');
} }