main.c
changeset 32 524fde5be49a
parent 31 54957980a83a
child 33 db5396037b43
--- a/main.c	Mon Mar 16 05:31:24 2009 +0200
+++ b/main.c	Mon Mar 16 05:58:10 2009 +0200
@@ -515,7 +515,7 @@
 /// completion type
 /// Built-it completion types can be specified as string, instead of id.
 /// G:
-static const string2enum_t lua_completion_type[] = {
+static string2enum_t lua_completion_type[] = { // not const,  we need to modify yesno
 	{ "cmd",       COMPL_CMD       },
 	{ "jid",       COMPL_JID       },
 	{ "urljid",    COMPL_URLJID    },
@@ -537,8 +537,10 @@
 	{ "color",     COMPL_COLOR     },
 	{ "otr",       COMPL_OTR       },
 	{ "ortpolicy", COMPL_OTRPOLICY },
+	{ "yesno",     0               },
 	{ NULL,        0               },
 };
+#define MLUA_YESNO_POS ( 21 )
 
 typedef struct {
 	int        reference;
@@ -1058,6 +1060,20 @@
 	lua_register (lua, "dopath", lua_global_dopath);
 	lua_register (lua, "print",  lua_global_print );
 
+	{
+		int cid = compl_new_category ();
+
+		if (cid) {
+			const string2enum_t *word = lua_yesno;
+			lua_completion_type[MLUA_YESNO_POS].value = cid;
+			lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) cid);
+			while (word->string) {
+				compl_add_category_word (cid, word->string);
+				++word;
+			}
+		}
+	}
+
 	cmd_add ("lua", "Evaluate lua string", 0, 0, (void (*) (char *p)) do_lua, lua);
 
 #ifdef LLM_LOG_HANDLER