files: give the user time to absorb a warning about someone else editing

That is: pause a little to jolt the user, and then leave the message
on the status bar.

This fixes https://savannah.gnu.org/bugs/?61147.

Bug existed since version 4.8, commit 416386ed.
master
Benno Schulenberg 2021-09-12 10:33:18 +02:00
parent 5cedb53c62
commit fe5f05f037
1 changed files with 5 additions and 3 deletions

View File

@ -245,9 +245,11 @@ char *do_lockfile(const char *filename, bool ask_the_user)
free(secondcopy); free(secondcopy);
free(namecopy); free(namecopy);
if (!ask_the_user && stat(lockfilename, &fileinfo) != -1) if (!ask_the_user && stat(lockfilename, &fileinfo) != -1) {
warn_and_briefly_pause(_("Someone else is also editing this file")); blank_bottombars();
else if (stat(lockfilename, &fileinfo) != -1) { statusline(ALERT, _("Someone else is also editing this file"));
napms(1200);
} else if (stat(lockfilename, &fileinfo) != -1) {
char *lockbuf, *question, *pidstring, *postedname, *promptstr; char *lockbuf, *question, *pidstring, *postedname, *promptstr;
static char lockprog[11], lockuser[17]; static char lockprog[11], lockuser[17];
int lockfd, lockpid, choice; int lockfd, lockpid, choice;