File src/cfg/info.c changed (mode: 100644) (index 2ce2d41e1..114cd50a5) |
... |
... |
put_sort_info(FILE *fp, char leading_char, const FileView *view) |
918 |
918 |
{ |
{ |
919 |
919 |
int i = -1; |
int i = -1; |
920 |
920 |
fputc(leading_char, fp); |
fputc(leading_char, fp); |
921 |
|
while(++i < SORT_OPTION_COUNT && view->sort[i] <= LAST_SORT_OPTION) |
|
|
921 |
|
while(++i < SORT_OPTION_COUNT && abs(view->sort[i]) <= LAST_SORT_OPTION) |
922 |
922 |
{ |
{ |
923 |
923 |
int last_option = i >= SORT_OPTION_COUNT - 1; |
int last_option = i >= SORT_OPTION_COUNT - 1; |
924 |
|
last_option = last_option || view->sort[i + 1] > LAST_SORT_OPTION; |
|
|
924 |
|
last_option = last_option || abs(view->sort[i + 1]) > LAST_SORT_OPTION; |
925 |
925 |
fprintf(fp, "%d%s", view->sort[i], last_option ? "" : ","); |
fprintf(fp, "%d%s", view->sort[i], last_option ? "" : ","); |
926 |
926 |
} |
} |
927 |
927 |
fputc('\n', fp); |
fputc('\n', fp); |
File src/opt_handlers.c changed (mode: 100644) (index 4c4356ce5..c0cef22aa) |
... |
... |
load_sort_option(FileView *view) |
431 |
431 |
char buf[64] = ""; |
char buf[64] = ""; |
432 |
432 |
int j, i; |
int j, i; |
433 |
433 |
|
|
434 |
|
for(j = 0; j < SORT_OPTION_COUNT && view->sort[j] <= LAST_SORT_OPTION; j++) |
|
|
434 |
|
j = -1; |
|
435 |
|
while(++j < SORT_OPTION_COUNT && abs(view->sort[j]) <= LAST_SORT_OPTION) |
435 |
436 |
{ |
{ |
436 |
437 |
const int sort_option = abs(view->sort[j]); |
const int sort_option = abs(view->sort[j]); |
437 |
438 |
if(sort_option == SORT_BY_NAME || sort_option == SORT_BY_INAME) |
if(sort_option == SORT_BY_NAME || sort_option == SORT_BY_INAME) |
|
... |
... |
load_sort_option(FileView *view) |
439 |
440 |
break; |
break; |
440 |
441 |
} |
} |
441 |
442 |
} |
} |
442 |
|
if(j < SORT_OPTION_COUNT && view->sort[j] > LAST_SORT_OPTION) |
|
|
443 |
|
if(j < SORT_OPTION_COUNT && abs(view->sort[j]) > LAST_SORT_OPTION) |
443 |
444 |
{ |
{ |
444 |
445 |
#ifndef _WIN32 |
#ifndef _WIN32 |
445 |
446 |
view->sort[j++] = SORT_BY_NAME; |
view->sort[j++] = SORT_BY_NAME; |
|
... |
... |
load_sort_option(FileView *view) |
449 |
450 |
} |
} |
450 |
451 |
|
|
451 |
452 |
i = -1; |
i = -1; |
452 |
|
while(++i < SORT_OPTION_COUNT && view->sort[i] <= LAST_SORT_OPTION) |
|
|
453 |
|
while(++i < SORT_OPTION_COUNT && abs(view->sort[i]) <= LAST_SORT_OPTION) |
453 |
454 |
{ |
{ |
454 |
455 |
const int sort_option = view->sort[i]; |
const int sort_option = view->sort[i]; |
455 |
456 |
if(buf[0] != '\0') |
if(buf[0] != '\0') |