Skip to content

Instantly share code, notes, and snippets.

@irisfofs
Created February 20, 2015 05:15
Show Gist options
  • Save irisfofs/d1a9c60f6b8ca598d270 to your computer and use it in GitHub Desktop.
Save irisfofs/d1a9c60f6b8ca598d270 to your computer and use it in GitHub Desktop.
currently broken attempt to allow tab-completion after arbitrary prefixes
if (size > 0)
{
i = pos;
pos_start = i;
ignore_prefix_chars = !CONFIG_STRING(config_completion_ignore_prefix_chars)
&& !CONFIG_STRING(config_completion_ignore_prefix_chars)[0];
/* only backtrack on a space, other characters would be unexpected */
if (data[i] == ' ') // Guards against a double space?
{
if ((i > 0) && (data[i-1] != ' ') && (ignore_prefix_chars
|| (!strchr (CONFIG_STRING(config_completion_ignore_prefix_chars),
data[i-1]))))
{
i--;
while ((i >= 0) && (data[i] != ' ') && (ignore_prefix_chars
|| (!strchr (CONFIG_STRING(config_completion_ignore_prefix_chars),
data[i]))))
{
i--;
}
pos_start = i + 1;
}
}
else
{
while ((i >= 0) && (data[i] != ' ') && (ignore_prefix_chars
|| (!strchr (CONFIG_STRING(config_completion_ignore_prefix_chars),
data[i]))))
{
i--;
}
pos_start = i + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment