Move the initialization of the operating directory to after the
initialization of the screen, so that the above error can be shown.
This fixes the first part of https://savannah.gnu.org/bugs/?47798.
Between the first stat (that sets 'realexists') and the second stat
(directly after), the file might have disappeared, which would mean
that current_stat would be NULL. Prevent dereferencing this further
down.
Only when the user decides not to override an existing lockfile should
loading the corresponding file be skipped. Any failure to write the
lockfile should be ignored -- the file itself should be loaded anyway.
This fixes https://savannah.gnu.org/bugs/?47945.
Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.
This fixes https://savannah.gnu.org/bugs/?47963.
The variable 'namecopy' has been passed to dirname(), so it is likely
to have been changed when it contains a slash. So, use a new variable
instead. Also, free the result of display_string().
This fixes https://savannah.gnu.org/bugs/?47956.
Having just opened a fresh buffer, 'openfile->next' will never be NULL,
because the list is circular.
Second, when compiled with --disable-nultibuffer, and deciding not to
override an existing lock, the 'return FALSE' should *not* be skipped,
because otherwise the named file will be opened after all.
This fixes an unreported bug.
Either the selected file was changed, or a file or directory was chosen
(and the Enter key virtually pressed), or a shortcut was executed. So,
just go and read the next key.
This fixes https://savannah.gnu.org/bugs/?47944.
If during startup there are multiple error messages, currently only the
last one remains and can be read. To improve on that, introduce a short
pause between error messages -- even if it's not enough to read them all,
at least the user will be aware that there are multiple ones.
This also causes a few error messages to beep that currently don't beep,
such as when a file is unwritable.
When doing a PageUp or PageDown in the browser, don't move the highlight
to the first line in the same column, but keep it in the same relative
position of the screen. If we're already on the first or last page,
move the highlight to the first or last line, but keep it in the same
column. If we're already on the first or last line, only then move it
to the first or last entry.
CONST_UPDATE is only relevant when in the main menu, not when in the
browser. So, check for that condition, instead of saving, changing,
and then restoring the setting.
There is no need to iterate through all the file names, as we already
know the length of the longest. From this it's easy to calculate how
many names fit on a line.
Also rename some things to be more fitting. And make sure that something
will be selected even when many files, including the selected one, have
disappeared.
When refreshing the screen (and thus the file list), use the prev_dir
mechanism to reselect the file that was selected before the refresh,
to prevent the selection from changing when files were added or deleted.
Also, when the selected name has disappeared, move the highlight one step
back, so that it is obvious that the selection has changed. (Decrementing
'selected' will never make it negative, because selected == 0 means the
'..' entry, and every directory has a '..' entry, so it will be found.)
This fixes https://savannah.gnu.org/bugs/?47812.
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
When during searching we look at the keyboard, then don't look at
just the first keystroke, but check if there are more, and if so,
check each one until we find a Cancel -- or until all keystrokes
have been consumed and we can continue.
This fixes the first half of https://savannah.gnu.org/bugs/?47438.