Browse code

Move score printing into draw_match

John Hawthorn authored on 14/09/2014 04:27:05
Showing 1 changed files

  • fzy.c index d299d42..f1b7302 100644
... ...
@@ -111,7 +111,10 @@ void draw_match(tty_t *tty, const char *choice, int selected){
111 111
 	for(int i = 0; i < n + 1; i++)
112 112
 		positions[i] = -1;
113 113
 
114
-	match_positions(search, choice, &positions[0]);
114
+	double score = match_positions(search, choice, &positions[0]);
115
+
116
+	if(flag_show_scores)
117
+		tty_printf(tty, "(%5.2f) ", score);
115 118
 
116 119
 	if(selected)
117 120
 		tty_setinvert(tty);
... ...
@@ -143,8 +146,6 @@ void draw(tty_t *tty){
143 146
 		tty_newline(tty);
144 147
 		if(i < choices_available){
145 148
 			size_t choice_idx = choices_sorted[i];
146
-			if(flag_show_scores)
147
-				tty_printf(tty, "(%5.2f) ", choices_score[choice_idx]);
148 149
 			draw_match(tty, choices[choice_idx], i == current_selection);
149 150
 		}
150 151
 	}