Browse code

Support UP/DOWN arrow

John Hawthorn authored on 17/08/2014 03:08:51
Showing 1 changed files

  • fzy.c index f99d735..10a5a7d 100644
... ...
@@ -198,6 +198,16 @@ void run(tty_t *tty){
198 198
 		}else if(ch == 10){ /* Enter */
199 199
 			clear(tty);
200 200
 			emit(tty);
201
+		}else if(ch == 27){ /* ESC */
202
+			ch = tty_getchar(tty);
203
+			if(ch == '['){
204
+				ch = tty_getchar(tty);
205
+				if(ch == 'A'){ /* UP ARROW */
206
+					action_prev();
207
+				}else if(ch == 'B'){ /* DOWN ARROW */
208
+					action_next();
209
+				}
210
+			}
201 211
 		}
202 212
 	}while(1);
203 213
 }