Commit Graph

16108 Commits

Author SHA1 Message Date
Andrew Borodin
a1b4eb0bfb Rename file_op_context_ui_t to file_progress_ui_t, reorder members.
No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
0a6604a626 Rename functions.
file_op_context_create_ui -> file_progress_ui_create
file_op_context_destroy_ui -> file_progress_ui_destroy
check_progress_buttons -> file_progress_check_buttons

No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
63db380705 (copy_file_file_display_progress): change arguments order.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
6d3c41082c (copy_file_file): fix the ETA calculation.
Pass only the size of the remaining part of file to
copy_file_file_display_progress().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
bf9a279d1a (file_eta_prepare_for_show): join checks of eta_secs.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
f911cf30cb Ticket #3205: fix ETA calculation.
Check "verbose" before file_progress_show() call.

  * (file_progress_show): don't chech "verbose" here.
  * (move_file_file): call file_progress_show() if "verbose" is on.
  * (do_move_dir_dir): likewise.
  * (copy_file_file): likewise, join checks.
  * (panel_operate): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Yury V. Zaytsev
c5b8b69371 Merge branch '2452_handle_baudrate_error'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-05 14:23:27 +01:00
Yury V. Zaytsev
8b8419023f Ticket #2452: handle -1 (baudrate error) by *not* disabling verbose mode implicitly
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>
2024-11-04 17:29:25 +01:00
Yury V. Zaytsev
ea8e239f00 Merge branch '4604_c99_automake_114'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 17:23:58 +01:00
Yury V. Zaytsev
6ea7bd0196 buildsys: disable buggy or unhelpful warnings
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 17:23:22 +01:00
Yury V. Zaytsev
43e6c040de buildsys: add -Wall and -Wextra, remove duplicate flags, set standard to C99
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 17:23:22 +01:00
Yury V. Zaytsev
fdc445ea8d buildsys: fix enabling C standards for older autoconf broken in 1bc8abd7
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 10:45:05 +01:00
Yury V. Zaytsev
ec66b0be04 buildsys: fix quoting and comment in configure.ac
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 10:45:05 +01:00
Yury V. Zaytsev
b9c7884ea7 buildsys: set debugging level to -Og per gcc recommendations
> If you are not using some other optimization option, consider using -Og (see
> Options That Control Optimization) with -g. With no -O option at all, some
> compiler passes that collect information useful for debugging do not run at
> all, so that -Og may result in a better debugging experience.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 10:45:05 +01:00
Yury V. Zaytsev
03c6f61d54 Ticket #4604: remove obsolete AM_PROG_CC_C_O macro, part of AC_PROG_CC now
`AM_PROG_CC_C_O` is part of `AC_PROG_CC` since Automake 1.14, released in 2013
and we are almost in 2025 by now.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 10:45:05 +01:00
Yury V. Zaytsev
d63427d7bd Merge branch '4599_bash_prompt_array'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-02 08:04:04 +01:00
Viorel Munteanu
18f0a28501 Ticket #4599: add support for bash PROMPT_COMMAND being an array
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>
2024-11-01 19:26:04 +01:00
Yury V. Zaytsev
fc3ad53228 Merge branch '4597_fish_csi'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 18:36:33 +01:00
Johannes Altmanninger
6ca2013082 subshell: advertise that we can suspend a shell that requested CSI u
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>
2024-11-01 18:34:18 +01:00
Johannes Altmanninger
6e4510b558 subshell: recognize CSI u encoding for ctrl-o
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>
2024-11-01 18:34:18 +01:00
Johannes Altmanninger
0ea77d2ec7 Ticket #4597: fix CSI parser
fish shell 4.0 wants to send sequences like "\x1b[=5u",
so strip them from the output as well.

See https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences

In future we should probably pass through some sequences like bracketed paste.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 18:10:09 +01:00
Yury V. Zaytsev
9e4e7e8a7f maint: fix paths in transifex scripts and workflows after the move
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 17:47:04 +01:00
Yury V. Zaytsev
494aeabe27 Merge branch '4170_github_ci'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 17:37:38 +01:00
Yury V. Zaytsev
61909fa24e mountlist: suppress unused label warning on FreeBSD
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 17:37:10 +01:00
Yury V. Zaytsev
58f75eeb2e doc: fix typo in ftp path - manual pages
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-01 17:37:10 +01:00
Kirill Rekhov
9985e2129b doc: fix groff warning in mc.1.in (closes MidnightCommander/mc#207)
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:22:53 +02:00
Yury V. Zaytsev
6881db8b16 posix: use tail -1, not tail -n 1, prefer gsed for Solaris compat
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>
2024-10-26 18:22:53 +02:00
Yury V. Zaytsev
577b253ab3 buildsys: remove -e from grep for compatibility with non-XPG4 grep
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:22:53 +02:00
Yury V. Zaytsev
289b9c85be (canonicalize_pathname_custom): fix --disable-charset build broken in 8f723b8
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:22:53 +02:00
Yury V. Zaytsev
a018086f48 maint: remove obsolete CI/maint and re-implement source index
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:22:46 +02:00
Yury V. Zaytsev
73ef95df41 maint: fix documentation linting script and add to CI
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:22:17 +02:00
Yury V. Zaytsev
319507c595 Ticket #4170: implement CI via GitHub Actions
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-26 18:20:45 +02:00
Yury V. Zaytsev
4bd73a7de0 Merge branch '2633_mclib_xterm_clear'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-22 14:42:01 +02:00
Yury V. Zaytsev
f0107ce193 Ticket #2633: add xterm-clear terminal definition for FreeBSD termcap
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-22 13:21:19 +02:00
Yury V. Zaytsev
9182a89922 filemanager: remove duplicate include header
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-20 20:38:29 +02:00
Andrew Borodin
b46e813120 Merge branch '4600_filter_segfault'
* 4600_filter_segfault:
  src/filemanager/{achown,chattr,chmod,chown}.c: get rid of code duplication.
  (panel_callback) [MSG_FOCUS]: remove self-draw here.
  Disable all cursor movements if file panel is empty.
  (start_search): don't start quick search if file panel is empty.
  Clarify panel->currrent if file panel is empty.
  Ticket #4600: fix segfault on panel filter.
2024-10-19 20:48:52 +03:00
Andrew Borodin
b232229b46 src/filemanager/{achown,chattr,chmod,chown}.c: get rid of code duplication.
* (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>
2024-10-19 20:45:22 +03:00
Andrew Borodin
2d9383fd54 (panel_callback) [MSG_FOCUS]: remove self-draw here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 20:02:59 +03:00
Andrew Borodin
b14f778e6b Disable all cursor movements if file panel is empty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 20:02:59 +03:00
Andrew Borodin
562eb7449a (start_search): don't start quick search if file panel is empty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-19 11:40:36 +03:00
Andrew Borodin
f147c8b3e2 Clarify panel->currrent if file panel is empty.
* (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>
2024-10-19 11:40:36 +03:00
Andrew Borodin
1ac839d20c Ticket #4600: fix segfault on panel filter.
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>
2024-10-19 11:38:31 +03:00
Yury V. Zaytsev
65fee2daf7 Merge branch '4584_tests_weak_symbols'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 09:01:19 +02:00
Yury V. Zaytsev
6c5cf214a9 extfs: use numeric (0/0) root user uid/gid in helpers instead of root/root
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>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
877ef7d78b tests: don't free after ck_abort_msg as it's marked no-return
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
22b80bf2d4 tests: fix -Winvalid-source-encoding warnings in path_recode
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5779e51e69 tests: fix -Winvalid-source-encoding warnings in config_string
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
15eeb94d2c tests: fix -Wmissing-variable-declarations warnings in vfs tests
```
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:39:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1;
                      ^
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:42:21: warning: no previous extern declaration for non-static variable 'vfs_root_entry' [-Wmissing-variable-declarations]
struct vfs_s_entry *vfs_root_entry;
                    ^
../../../../tests/lib/vfs/vfs_s_get_path.c:40:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
                      ^
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5b63416d04 tests: fix -Wmissing-variable-declarations warnings in filevercmp
```
../../../../tests/lib/strutil/filevercmp.c:213:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds2_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds2_len = G_N_ELEMENTS (filevercmp_test_ds2);
             ^
../../../../tests/lib/strutil/filevercmp.c:250:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds3_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds3_len = G_N_ELEMENTS (filevercmp_test_ds3);
             ^
../../../../tests/lib/strutil/filevercmp.c:288:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds4_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds4_len = G_N_ELEMENTS (filevercmp_test_ds4);
             ^
../../../../tests/lib/strutil/filevercmp.c:349:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds5_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds5_len = G_N_ELEMENTS (filevercmp_test_ds5);
             ^
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
93b539444b Ticket #4584: re-implement mocking via weak symbols instead of symbol duplication
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:40 +02:00