Commit Graph

16134 Commits

Author SHA1 Message Date
Andrew Borodin
c2eb73bb2c Merge branch '4608_mcdiff_segfault'
* 4608_mcdiff_segfault:
  Ticket #4608: mcdiff: segmentation fault on empty files merge.
2024-12-05 20:59:44 +03:00
Andrew Borodin
8548796e75 Ticket #4608: mcdiff: segmentation fault on empty files merge.
(get_current_hunk): immediately return if hunk list is empty.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-12-04 21:02:21 +03:00
Andrew Borodin
f85f7fec29 Merge branch '3205_eta'
* 3205_eta: (29 commits)
  Update po/*.po files.
  doc: update EN and RU man pages.
  Calculate pauses in file operations.
  File copy/move: make ETA accurate.
  (calc_copy_file_progress): clarify calculation of BPSes and ETAs.
  (panel_operate): use intermediate variable for better indentation.
  (copy_file_file): clarify handling of mc_open() errors.
  (copy_file_file): fix handling of mc_open() error.
  (calc_copy_file_progress): rename from copy_file_file_display_progress().
  (file_progress_show_total): add 'tv_current' argument.
  (file_progress_show_total): use 'copied_bytes' to show numeric value.
  (file_progress_show_count): remove 'done' and 'total' arguments.
  (erase_dir_iff_empty): remove 'count' argument.
  (file_op_context_t): rename members.
  (copy_file_file): reduce variable scope, change order of progress update.
  (file_op_context_t): reorder members.
  Move content of src/filemanager/fileopctx.[ch] to src/filemanager/filegui.[ch].
  (file_op_total_context_t): remove. All members were moved to file_op_context_t.
  (file_op_total_context_t): rename members.
  (copy_file_file_display_progress): remove dead code.
  ...
2024-11-13 19:38:42 +03:00
Andrew Borodin
883aec7625 Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:02 +03:00
Andrew Borodin
c3fa92d89a doc: update EN and RU man pages. 2024-11-13 19:38:01 +03:00
Andrew Borodin
5047d4d114 Calculate pauses in file operations.
Calculate BPS and ETA, taking into account pauses due to query
dialog boxes.

  * (file_op_context_t): new 'pauses' member.
  * (file_error): pass file operation context to calculate pause.
  * (real_warn_same_file): likewise.
  * (real_do_file_error): likewise.
  * (real_query_recursive): calculate pause.
  * (overwrite_query_dialog): likewise.
  * (file_progress_show_total): use ctx->pauses to show time of
    operation.
  * (calc_copy_file_progress): calculate use ctx->pauses to calculate ETA.
  * (warn_same_file):
  * (check_same_file):
  * (check_hardlinks):
  * (make_symlink):
  * (do_file_error):
  * (files_error):
  * (try_remove_file):
  * (move_file_file):
  * (try_erase_dir):
  * (do_move_dir_dir):
  * (copy_file_file):
  * (copy_dir_dir):
  * (panel_operate):
  * (tree_move): related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:01 +03:00
Andrew Borodin
1e35ae3adb File copy/move: make ETA accurate.
* (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>
2024-11-13 19:38:01 +03:00
Andrew Borodin
ff1a404bb3 (calc_copy_file_progress): clarify calculation of BPSes and ETAs.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:01 +03:00
Andrew Borodin
07ea52d767 (panel_operate): use intermediate variable for better indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:00 +03:00
Andrew Borodin
e2ca50418d (copy_file_file): clarify handling of mc_open() errors.
Handle mc_open() errors in the same way as mc_fstat().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:00 +03:00
Andrew Borodin
25fb677b87 (copy_file_file): fix handling of mc_open() error.
In case of FILE_IGNORE, immediately stop processing of file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:38:00 +03:00
Andrew Borodin
e6e329bc8c (calc_copy_file_progress): rename from copy_file_file_display_progress().
Refactoring, reuse variable.

(file_op_context_t): remove 'bps_time' member. It's unused anymore.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
d844c6212c (file_progress_show_total): add 'tv_current' argument.
Get rid of g_get_monotonic_time() here. If possible, use time value
calculated before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
6ba3cc68c0 (file_progress_show_total): use 'copied_bytes' to show numeric value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
2b1a63aef3 (file_progress_show_count): remove 'done' and 'total' arguments.
Use members of 'ctx' instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
7c418111fd (erase_dir_iff_empty): remove 'count' argument.
Use 'ctx->progress_count' instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
527cb1424d (file_op_context_t): rename members.
copied_bytes -> total_progress_bytes
progress_count -> total_progress_count
prev_progress_count -> prev_total_progress_count

No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
debd1ee8ce (copy_file_file): reduce variable scope, change order of progress update.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
64c6de4ab8 (file_op_context_t): reorder members.
No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-13 19:37:59 +03:00
Andrew Borodin
17fd844315 Move content of src/filemanager/fileopctx.[ch] to src/filemanager/filegui.[ch].
No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
b2b10f1f87 (file_op_total_context_t): remove. All members were moved to file_op_context_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
dde9002aaf (file_op_total_context_t): rename members.
bps -> total_bps
transfer_start -> total_transfer_start
eta_secs -> total_eta_secs

No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
ab5bbba2dd (copy_file_file_display_progress): remove dead code.
(file_op_total_context_t): bps_count member is unused. Remove it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
23ed903814 (file_op_context_t): rename members.
progress_count -> total_count
progress_bytes -> total_bytes
progress_totals_computed -> totals_computed

No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
Andrew Borodin
31771bd332 Store start time of file transfer in the file operation context descriptor.
* (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>
2024-11-05 18:19:28 +03:00
Andrew Borodin
f699e184ea (file_op_context_new): simplify.
Don't NULLify members. This is already done by call of g_new0().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-11-05 18:19:28 +03:00
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