File src/cmdline.c changed (mode: 100644) (index 164f5d821..f3ee73a13) |
... |
... |
option_completion(char* line_mb, struct line_stats *stat) |
1300 |
1300 |
} |
} |
1301 |
1301 |
stat->line = (wchar_t *) t; |
stat->line = (wchar_t *) t; |
1302 |
1302 |
|
|
1303 |
|
line_ending = (wchar_t *) malloc((wcslen(stat->line |
|
1304 |
|
+ stat->index) + 1) * sizeof(wchar_t)); |
|
|
1303 |
|
line_ending = my_wcsdup(stat->line + stat->index); |
1305 |
1304 |
if(line_ending == NULL) |
if(line_ending == NULL) |
1306 |
1305 |
{ |
{ |
1307 |
1306 |
free(completed); |
free(completed); |
1308 |
1307 |
return -1; |
return -1; |
1309 |
1308 |
} |
} |
1310 |
|
wcscpy(line_ending, stat->line + stat->index); |
|
1311 |
1309 |
|
|
1312 |
1310 |
swprintf(stat->line + (p - line_mb), new_len, L"%s%ls", completed, |
swprintf(stat->line + (p - line_mb), new_len, L"%s%ls", completed, |
1313 |
1311 |
line_ending); |
line_ending); |
|
... |
... |
file_completion(char* filename, char* line_mb, struct line_stats *stat) |
1375 |
1373 |
x = *temp; |
x = *temp; |
1376 |
1374 |
*temp = '\0'; |
*temp = '\0'; |
1377 |
1375 |
|
|
1378 |
|
temp2 = (wchar_t *) malloc((wcslen(stat->line |
|
1379 |
|
+ stat->index) + 1) * sizeof(wchar_t)); |
|
|
1376 |
|
temp2 = my_wcsdup(stat->line + stat->index); |
1380 |
1377 |
if(temp2 == NULL) |
if(temp2 == NULL) |
1381 |
|
{ |
|
1382 |
|
free(temp2); |
|
1383 |
1378 |
return -1; |
return -1; |
1384 |
|
} |
|
1385 |
|
wcscpy(temp2, stat->line + stat->index); |
|
1386 |
1379 |
|
|
1387 |
1380 |
i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) |
i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) |
1388 |
1381 |
+ (stat->len - stat->index) + 1; |
+ (stat->len - stat->index) + 1; |
|
... |
... |
file_completion(char* filename, char* line_mb, struct line_stats *stat) |
1418 |
1411 |
x = *temp; |
x = *temp; |
1419 |
1412 |
*temp = '\0'; |
*temp = '\0'; |
1420 |
1413 |
|
|
1421 |
|
temp2 = (wchar_t *) malloc((wcslen(stat->line |
|
1422 |
|
+ stat->index) + 1) * sizeof(wchar_t)); |
|
|
1414 |
|
temp2 = my_wcsdup(stat->line + stat->index); |
1423 |
1415 |
if(temp2 == NULL) |
if(temp2 == NULL) |
1424 |
|
{ |
|
1425 |
1416 |
return -1; |
return -1; |
1426 |
|
} |
|
1427 |
|
wcscpy(temp2, stat->line + stat->index); |
|
1428 |
1417 |
|
|
1429 |
1418 |
i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) |
i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) |
1430 |
1419 |
+ (stat->len - stat->index) + 1; |
+ (stat->len - stat->index) + 1; |
|
... |
... |
file_completion(char* filename, char* line_mb, struct line_stats *stat) |
1444 |
1433 |
*temp = x; |
*temp = x; |
1445 |
1434 |
free(temp2); |
free(temp2); |
1446 |
1435 |
} |
} |
1447 |
|
/* error */ |
|
1448 |
|
else |
|
1449 |
|
{ |
|
1450 |
|
show_error_msg("Debug Error", "Harmless error in rline.c line 564"); |
|
1451 |
|
return -1; |
|
1452 |
|
} |
|
1453 |
1436 |
|
|
1454 |
1437 |
redraw_status_bar(stat); |
redraw_status_bar(stat); |
1455 |
1438 |
return 0; |
return 0; |
File src/utils.h changed (mode: 100644) (index dacc50ea9..7c290a817) |
... |
... |
size_t get_utf8_overhead(const char *string); |
49 |
49 |
size_t get_utf8_prev_width(char *string, size_t cut_length); |
size_t get_utf8_prev_width(char *string, size_t cut_length); |
50 |
50 |
wchar_t * to_wide(const char *s); |
wchar_t * to_wide(const char *s); |
51 |
51 |
void run_from_fork(int pipe[2], int err, char *cmd); |
void run_from_fork(int pipe[2], int err, char *cmd); |
52 |
|
wchar_t * my_wcsdup(wchar_t *ws); |
|
|
52 |
|
wchar_t * my_wcsdup(const wchar_t *ws); |
53 |
53 |
|
|
54 |
54 |
#endif |
#endif |
55 |
55 |
|
|