* (progress_update_one): update total progress bytes counter. Update
progress info in the progress window only if file was processed
successfully. Don't check buttons here.
* (move_file_file): update progress info if file move wasn't aborted.
* (copy_file_file): update progress info if stat() or open() failed
(file size is unknown, but file counter shoud be updated). Modify
caclulation and display of byte counters.
* (panel_operate): simplify files processing loop. Remove action that
already done via operate_one_file() call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (file_op_context_t): new member transfer_start.
* (copy_file_file_display_progress): remove tv_transfer_start
argument, use ctx->transfer_start instead.
* (copy_file_file): sync with modified file_op_context_t and
copy_file_file_display_progress().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
If we can't reliably identify slow terminal, we should not implicitly disable
verbose mode, instead let user disable it manually by starting with the slow
terminal switch.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Starting with bash 5.1, PROMPT_COMMAND can be an array. Detect this
case and append an entry to the array instead of appending to a string.
Testing for bash >= 5 is sufficient, because the @a operator exists in
5.0. We need eval on the "then" branch because bash 1.x cannot even
parse that line (it does not support arrays).
Bug: https://bugs.gentoo.org/930401
Suggested-by: kfm@plushkava.net
Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Add a new variable to let fish know that -- since the parent commit
-- we are running a version where fish can use the kitty keyboard
protocol without breaking mc.
In a few years, both fish and mc should ideally remove this hack
(and fish should speak the kitty keyboard protocol unconditionally),
so no one should rely on this new variable except as a temporary
workaround. Hence the feature-specific flag and not a generic version
variable.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
If a subshell (like fish 4.0) wishes to use "Disambiguate control keys"
from https://sw.kovidgoyal.net/kitty/keyboard-protocol/, ctrl-o sends
a multi-byte sequence. Let's make sure we can intercept that too so
we can suspend the shell.
Note that the shell already disables "Disambiguate control keys"
while it's suspended, so no other changes should be necessary.
Unfortunately there is one bug left: when I start "SHELL=$(which
fish) mc" and type `ctrl-o`, fish does not recognize CSI u bindings
(such as `bind ctrl-2 'echo hello'`) yet. It only works after the
second prompt. I haven't had time to figure that out.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Non-XPG4 version of `tail` fails if you call it as `tail -n 1`, but `tail -1`
works everywhere and is portable.
```
% ssh solaris
Last login: Sun Oct 20 12:20:56 2024 from 192.168.64.1
Oracle Solaris 11.4.42.111.0 Assembled December 2021
root@solaris:~# tail -n 1 .profile
usage: tail [+/-[n][lbc][f]] [file]
tail [+/-[n][l][r|f]] [file]
root@solaris:~# tail -1 .profile
root@solaris:~# head -n 1 .profile
root@solaris:~# head -1 .profile
root@solaris:~# /usr/xpg4/bin/tail -n 1 .profile
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* (panel_find_marked_file):
* (panel_get_marked_file): new WPanel APIs.
* Use these APIs in src/filemanager/{achown,chattr,chmod,chown}.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (panel_do_cd_int): set panel->current to -1 file list is empty.
* (panel_set_current_by_name): likewise.
* (panel_sized_with_dir_new): likewise.
* (panel_reload): likewise.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
mc segfaults if filter makes file panel empty.
* (panel_current_entry): improve. Add checks if panel->current is in
range of file list.
* A lot of changes to use modified panel_current_entry().
* (format_file):
* (display_mini_info): fix drawing of mini-status if file panel is
empty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Non-Linux systems don't always name the user and group with uid/gid of 0
"root". On macOS group "wheel" has gid of 0 and group "root" doesn't exist. On
FreeBSD there is a user with gid of 0 named "toor". This causes user/group id
lookups in mc to fail and instead return the uid/gid of the current user.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Don't show an error message if mc_fgetflags() and mc_fsetflags()
fails and errno set to ENOTSUP, EOPNOTSUPP, ENOSYS, and EINVAL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>