summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
authorJune McEnroe2022-07-30 18:47:26 -0400
committerJune McEnroe2022-07-30 18:47:26 -0400
commit14a6486b9b2b9522982cde12c05b20931fe34999 (patch)
tree672349f06f9e998e6859a937230cc32787af2d9f /input.c
parentc0be6fe4b207fe8f57e8a9a97734302b15733831 (diff)
Switch to cache interfaces
Diffstat (limited to 'input.c')
-rw-r--r--input.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/input.c b/input.c
index 87a4eb9..739d889 100644
--- a/input.c
+++ b/input.c
@@ -261,12 +261,12 @@ static const struct {
 	{ L"\\wave", L"ヾ(^∇^)" },
 };
 
-void inputCompleteAdd(void) {
+void inputCache(void) {
 	char mbs[256];
 	for (size_t i = 0; i < ARRAY_LEN(Macros); ++i) {
 		size_t n = wcstombs(mbs, Macros[i].name, sizeof(mbs));
 		assert(n != (size_t)-1);
-		completeAdd(None, mbs, Default);
+		cacheInsert(false, None, mbs);
 	}
 }
 
@@ -296,15 +296,16 @@ static struct {
 	size_t pos;
 	size_t len;
 	bool suffix;
+	struct Cursor curs;
 } tab;
 
 static void tabAccept(void) {
-	completeAccept();
+	cacheAccept(&tab.curs);
 	tab.len = 0;
 }
 
 static void tabReject(void) {
-	completeReject();
+	cacheReject(&tab.curs);
 	tab.len = 0;
 }
 
@@ -332,9 +333,9 @@ static int tabComplete(struct Edit *e, uint id) {
 		tab.suffix = true;
 	}
 
-	const char *comp = complete(id, tab.pre);
+	const char *comp = cachePrefix(&tab.curs, id, tab.pre);
 	if (!comp) {
-		comp = complete(id, tab.pre);
+		comp = cachePrefix(&tab.curs, id, tab.pre);
 		tab.suffix ^= true;
 	}
 	if (!comp) {