@@ 20,6 20,24 @@ Hopefully this will build the community and reduce duplicated effort.
NeoMutt was created when Richard Russon (@FlatCap) took all the old Mutt patches,
sorted through them, fixed them up and documented them.
+## My patch
+
+My patch do add a fancy sidebar menu, which I feel is better than the original
+one. I'm not planning on upstreaming this, since it's pretty much the ugliest
+code in the world. I'll try to keep up to date with the upstream if people are
+planning on using it.
+
+### Configuration
+
+ # Sidebar Patch --------------------------------------
+ set sidebar_format = "%B %?N?%N?"
+ set sidebar_visible = yes
+ set sidebar_width = 30
+ set sidebar_short_path = yes
+
+
+
+
## What Features does NeoMutt have?
| Name | Description
@@ 275,8 275,8 @@ static void make_sidebar_entry(char *buf, size_t buflen, int width,
if (w < width)
{
/* Pad with spaces */
memset(buf + s, ' ', width - w);
buf[s + width - w] = '\0';
memset(buf + s, ' ', width - w - 6);
buf[s + width - w - 6] = '\0';
}
else if (w > width)
{
@@ 821,6 821,8 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
{
struct SbEntry *entry = NULL;
struct Mailbox *m = NULL;
char *title = NULL;
if (TopIndex < 0)
return;
@@ 950,8 952,33 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
}
}
char str[256];
size_t z = strlen(entry->mailbox->realpath);
size_t j;
for (; z > 0 && entry->mailbox->realpath[z] != '/'; z--)
;
for (j = z - 1; j > 0 && entry->mailbox->realpath[j] != '/'; j--)
;
entry->mailbox->realpath[z] = 0;
if (title == NULL || strcmp(entry->mailbox->realpath + j + 1, title))
{
title = strdup(entry->mailbox->realpath + j + 1);
mutt_window_printf("%s", entry->mailbox->realpath + j + 1);
row++;
mutt_window_move(MuttSidebarWindow, row, 0);
}
entry->mailbox->realpath[z] = '/';
make_sidebar_entry(str, sizeof(str), w, sidebar_folder_name, entry);
mutt_window_printf("%s", str);
if (entryidx + 1 == EntryCount || strncmp(entry->mailbox->realpath + j + 1, Entries[entryidx + 1]->mailbox->realpath + j + 1, z - j))
mutt_window_printf(" └─ %s", str);
else
mutt_window_printf(" ├─ %s", str);
mutt_buffer_pool_release(&short_folder_name);
row++;
}