xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit c3f3b740431e55ecf2f255c8086faf2e711c0c89

Use absolute values of sort options in comparisons
Otherwise they will catch only one of two cases.
Author: xaizek
Author date (UTC): 2013-01-06 17:05
Committer name: xaizek
Committer date (UTC): 2013-01-06 17:05
Parent(s): 95fda4671fd3da99232ee6059dc5b83999cdd67c
Signing key:
Tree: bd1779b0380188ec49ff855e614253b2af3e542b
File Lines added Lines deleted
src/cfg/info.c 2 2
src/opt_handlers.c 4 3
src/sort.c 1 1
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')
File src/sort.c changed (mode: 100644) (index 71d2b2c0b..e69003538)
... ... sort_view(FileView *v)
63 63 { {
64 64 int j; int j;
65 65
66 if(view->sort[i] > LAST_SORT_OPTION)
66 if(abs(view->sort[i]) > LAST_SORT_OPTION)
67 67 { {
68 68 continue; continue;
69 69 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master