aboutsummaryrefslogtreecommitdiff
path: root/src/edbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/edbox.c')
-rw-r--r--src/edbox.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/edbox.c b/src/edbox.c
index 6ac1e7c..5d529d3 100644
--- a/src/edbox.c
+++ b/src/edbox.c
@@ -5,12 +5,13 @@
#include "screen.h"
#include "edbox.h"
#include "keyclick.h"
+#include "complete.h"
/* TODO: tab completion */
int edbox_visible = 0;
static u16 edbox_pos; /* range 0 to EDBOX_SIZE - 1 */
-static u16 edbox_len; /* idem */
+u16 edbox_len; /* idem */
void (*edbox_callback)(void);
@@ -133,6 +134,9 @@ static void normal_keystroke(void) {
c = cgetc();
+ if(c != CH_TAB)
+ comp_complete_done();
+
switch(c) {
case CH_EOL:
// hide_cursor(); // already done by the caller
@@ -189,6 +193,9 @@ static void normal_keystroke(void) {
case 0x05: /* ^E */
edbox_pos = edbox_len;
break;
+ case CH_TAB:
+ comp_complete();
+ break;
default:
edbox_putc(c);
break;
@@ -264,3 +271,11 @@ void edbox_keystroke(void) {
if(edbox_visible) edbox_show();
show_cursor();
}
+
+void edbox_set(char *contents) {
+ edbox_clear();
+ while(*contents) {
+ edit_box[edbox_len++] = *contents++;
+ }
+ edbox_pos = edbox_len;
+}