matches = completion_matches(text, complete_from_versioned_schema_query); \
} while (0)
+/*
+ * Caution: COMPLETE_WITH_CONST is not for general-purpose use; you probably
+ * want COMPLETE_WITH() with one element, instead.
+ */
+#define COMPLETE_WITH_CONST(cs, con) \
+do { \
+ completion_case_sensitive = (cs); \
+ completion_charp = (con); \
+ matches = completion_matches(text, complete_from_const); \
+} while (0)
+
#define COMPLETE_WITH_LIST_INT(cs, list) \
do { \
completion_case_sensitive = (cs); \
- if (!(list)[1]) \
- { \
- completion_charp = (list)[0]; \
- matches = completion_matches(text, complete_from_const); \
- } \
- else \
- { \
- completion_charpp = (list); \
- matches = completion_matches(text, complete_from_list); \
- } \
+ completion_charpp = (list); \
+ matches = completion_matches(text, complete_from_list); \
} while (0)
#define COMPLETE_WITH_LIST(list) COMPLETE_WITH_LIST_INT(false, list)
*/
if (matches == NULL)
{
- COMPLETE_WITH("");
+ COMPLETE_WITH_CONST(true, "");
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
rl_completion_append_character = '\0';
#endif
/*
* This function returns one fixed string the first time even if it doesn't
- * match what's there, and nothing the second time. This should be used if
- * there is only one possibility that can appear at a certain spot, so
- * misspellings will be overwritten. The string to be passed must be in
- * completion_charp.
+ * match what's there, and nothing the second time. The string
+ * to be used must be in completion_charp.
+ *
+ * If the given string is "", this has the effect of preventing readline
+ * from doing any completion. (Without this, readline tries to do filename
+ * completion which is seldom the right thing.)
+ *
+ * If the given string is not empty, readline will replace whatever the
+ * user typed with that string. This behavior might be useful if it's
+ * completely certain that we know what must appear at a certain spot,
+ * so that it's okay to overwrite misspellings. In practice, given the
+ * relatively lame parsing technology used in this file, the level of
+ * certainty is seldom that high, so that you probably don't want to
+ * use this. Use complete_from_list with a one-element list instead;
+ * that won't try to auto-correct "misspellings".
*/
static char *
complete_from_const(const char *text, int state)