Commit Diff


commit - 69980762e94af37ac9930afe1f00af0bef6cad37
commit + fea02b0bf5e8d28eb46dd51dc411aa2836905b1f
blob - b208291f42a1cd30436808fbdff5f93802ce7063
blob + ccb571e9dca92633ca0afe9be381a797156e874d
--- cmd.c
+++ cmd.c
@@ -828,13 +828,13 @@ cmd_previous_completion(struct buffer *buffer)
 		return;
 
 	buffer = &ministate.compl.buffer;
+	if (buffer->current_line == NULL)
+		return;
 
-	if (buffer->current_line != NULL)
+	buffer->current_line->parent->type = LINE_COMPL;
+	if (!forward_line(buffer, -1))
 		buffer->current_line->parent->type = LINE_COMPL;
-
-	forward_line(buffer, -1);
-
-	if (buffer->current_line != NULL)
+	else
 		buffer->current_line->parent->type = LINE_COMPL_CURRENT;
 }
 
@@ -845,12 +845,14 @@ cmd_next_completion(struct buffer *buffer)
 		return;
 
 	buffer = &ministate.compl.buffer;
+	if (buffer->current_line == NULL)
+		return;
 
-	if (buffer->current_line != NULL)
+	if (buffer->current_line->parent->type == LINE_COMPL_CURRENT) {
 		buffer->current_line->parent->type = LINE_COMPL;
+		forward_line(buffer, +1);
+	}
 
-	forward_line(buffer, +1);
-
 	if (buffer->current_line != NULL)
 		buffer->current_line->parent->type = LINE_COMPL_CURRENT;
 }
blob - d303e21303f76bf05163e3830d131ac8c87c551c
blob + db9b9cb21f66e7045e98eebe15d92d97f935db9b
--- minibuffer.c
+++ minibuffer.c
@@ -91,7 +91,6 @@ recompute_completions(int add)
 	char		*input, **ap, *words[10];
 	size_t		 len = 0;
 	struct line	*l;
-	struct vline	*vl;
 	struct buffer	*b;
 
 	if (in_minibuffer != MB_COMPREAD)
@@ -126,9 +125,6 @@ recompute_completions(int add)
 	if (b->current_line == NULL)
 		b->current_line = TAILQ_FIRST(&b->head);
 	b->current_line = adjust_line(b->current_line, b);
-	vl = b->current_line;
-	if (vl != NULL)
-		vl->parent->type = LINE_COMPL_CURRENT;
 }
 
 int
@@ -475,9 +471,6 @@ populate_compl_buffer(complfn *fn, void *data)
 		linedata = NULL;
 		descr = NULL;
 	}
-
-	if ((l = TAILQ_FIRST(&p->head)) != NULL)
-		l->type = LINE_COMPL_CURRENT;
 }
 
 void