fix for filesel autocomplete, it had the annoying behavior if you entered in a non-existing name, of executing it and then asking to add the dir.

This commit is contained in:
2013-06-19 11:53:48 +00:00
parent 15016873ab
commit 9d4cc7885d
7 changed files with 37 additions and 24 deletions

View File

@@ -3086,16 +3086,21 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
}
}
void autocomplete_end(AutoComplete *autocpl, char *autoname)
bool autocomplete_end(AutoComplete *autocpl, char *autoname)
{
if (autocpl->truncate[0])
bool change = false;
if (autocpl->truncate[0]) {
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
change = true;
}
else {
if (autoname != autocpl->startname) /* don't copy a string over its self */
if (autoname != autocpl->startname) { /* don't copy a string over its self */
BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
}
}
MEM_freeN(autocpl->truncate);
MEM_freeN(autocpl);
return change;
}
static void ui_check_but_and_iconize(uiBut *but, int icon)