diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-04-16 21:26:47 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-04-16 21:29:35 +0200 |
commit | 2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc (patch) | |
tree | a290ae09b3ad0cef4602796ec7345d889279d9ab | |
parent | 75b2fc1da23df41d501f5b2d2e2a9bacc71e445b (diff) | |
download | xK-2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc.tar.gz xK-2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc.tar.xz xK-2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc.zip |
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
-rw-r--r-- | degesch.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1291,13 +1291,22 @@ refresh_prompt (struct app_context *ctx) str_append_printf (&prompt, "(%s) ", unseen_prefix); free (unseen_prefix); - str_append (&prompt, buffer->name); - if (buffer->type == BUFFER_CHANNEL) + int buffer_index = 1; + for (struct buffer *iter = ctx->buffers; + iter && iter != buffer; iter = iter->next) + buffer_index++; + + str_append_printf (&prompt, "%d:%s", buffer_index, buffer->name); + if (buffer->type == BUFFER_CHANNEL && *buffer->mode) str_append_printf (&prompt, "(%s)", buffer->mode); - str_append_c (&prompt, ' '); - str_append (&prompt, ctx->irc_nickname); - str_append_printf (&prompt, "(%s)", ctx->irc_user_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, ']'); } |