summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-04-16 21:26:47 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-04-16 21:29:35 +0200
commit2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc (patch)
treea290ae09b3ad0cef4602796ec7345d889279d9ab /degesch.c
parent75b2fc1da23df41d501f5b2d2e2a9bacc71e445b (diff)
downloadxK-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
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/degesch.c b/degesch.c
index f65292a..64280c8 100644
--- a/degesch.c
+++ b/degesch.c
@@ -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, ']');
}