mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 14:53:26 +01:00
Partially fix autocomplete behaviour for input with spaces
This commit is contained in:
parent
f7b73af9a7
commit
05eda76643
@ -126,7 +126,7 @@ static int complete_line_helper(ToxWindow *self, const void *list, size_t n_item
|
|||||||
snprintf(tmp, sizeof(tmp), "%s", ubuf);
|
snprintf(tmp, sizeof(tmp), "%s", ubuf);
|
||||||
tmp[ctx->pos] = '\0';
|
tmp[ctx->pos] = '\0';
|
||||||
|
|
||||||
const char *s = strrchr(tmp, ' ');
|
const char *s = dir_search ? strchr(tmp, ' ') : strrchr(tmp, ' ');
|
||||||
char *sub = calloc(1, strlen(ubuf) + 1);
|
char *sub = calloc(1, strlen(ubuf) + 1);
|
||||||
|
|
||||||
if (sub == NULL) {
|
if (sub == NULL) {
|
||||||
@ -221,10 +221,20 @@ static int complete_line_helper(ToxWindow *self, const void *list, size_t n_item
|
|||||||
if (dir_search && *endchrs == '/') {
|
if (dir_search && *endchrs == '/') {
|
||||||
const char *path_start = strchr(ubuf+1, '/');
|
const char *path_start = strchr(ubuf+1, '/');
|
||||||
|
|
||||||
if (!path_start) { // should never happen
|
if (!path_start) {
|
||||||
|
path_start = strchr(ubuf+1, ' ');
|
||||||
|
|
||||||
|
if (!path_start) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(path_start) < 2) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++path_start;
|
||||||
|
|
||||||
if (file_type(path_start) == FILE_TYPE_REGULAR) {
|
if (file_type(path_start) == FILE_TYPE_REGULAR) {
|
||||||
endchrs = "";
|
endchrs = "";
|
||||||
diff -= n_endchrs;
|
diff -= n_endchrs;
|
||||||
|
Loading…
Reference in New Issue
Block a user