From 948a67dff4536065e056abbd0d5e6ad97041a533 Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Tue, 11 Mar 2014 19:36:00 +0000 Subject: [PATCH] fix dired bug on first entry * add missing initialization, prevented display of first file in list * fix same bug in bufed --- bufed.c | 1 + dired.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bufed.c b/bufed.c index 8b2a3a3..ec00de6 100644 --- a/bufed.c +++ b/bufed.c @@ -363,6 +363,7 @@ static int bufed_mode_init(EditState *s, ModeSavedData *saved_data) return -1; bs->signature = &bufed_signature; + bs->last_index = -1; s->b->priv_data = bs; s->b->close = bufed_close; } diff --git a/dired.c b/dired.c index 051812b..7c7d562 100644 --- a/dired.c +++ b/dired.c @@ -96,8 +96,8 @@ static char *dired_get_filename(EditState *s, if (!(ds = dired_get_state(s, 1))) return NULL; - /* CG: assuming buf_size > 0 */ - buf[0] = '\0'; + if (buf_size > 0) + buf[0] = '\0'; if (index < 0) index = dired_get_index(s); @@ -576,6 +576,7 @@ static int dired_mode_init(EditState *s, ModeSavedData *saved_data) ds->signature = &dired_signature; ds->sort_mode = DIRED_SORT_GROUP | DIRED_SORT_NAME; + ds->last_index = -1; s->b->priv_data = ds; s->b->close = dired_close;