From 2d4adaefbf8682d0aac7d0328d7342d8f6ea2fdc Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 16 Apr 2015 21:26:47 +0200
Subject: 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
---
degesch.c | 19 ++++++++++++++-----
1 file 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, ']');
}
--
cgit v1.2.3-70-g09d2