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;