← Commit list

a3ce16136

Denys Vlasenko
Denys Vlasenko
2019-04-03
SUCCESS Duration: 152s

Subject

vi: revert change in how "end of file list" is deteced - fixes 'q' in bare "vi"

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/vi.c+2 -2
@@ -2625,7 +2625,7 @@ static void colon(char *buf)
if (useforce) {
if (*cmd == 'q') {
// force end of argv list
- optind = cmdline_filecnt - 1;
+ optind = cmdline_filecnt;
}
editing = 0;
goto ret;
@@ -4384,7 +4384,7 @@ int vi_main(int argc, char **argv)
edit_file(argv[optind]); // might be NULL on 1st iteration
// NB: optind can be changed by ":next" and ":rewind" commands
optind++;
- if (!argv[optind])
+ if (optind >= cmdline_filecnt)
break;
}
// "Use normal screen buffer, restore cursor"