Commit Graph

260 Commits

Author SHA1 Message Date
Andrew Borodin 67ec86b570 Ticket #4141: allow compound (AND) conditions in mc.ext
...to disambiguate overloaded extensions

Initial commit:
  * rename macro for mc.ext file: MC_FILEBIND_FILE -> MC_EXT_FILE.
  * (ext_cmd): fix errorous usage of MC_LIB_EXT macro. Use MC_EXT_FILE
    instead.
  * (regex_command_for): likewise. Use already existing variable
    extension_file, remove variable filebind_filename.
  * MC_LIB_EXT: remove macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Steef Boerrigter e370818c09 Ticket #400: support multi-line search.
In order to use multiline search, select "Regular expression" mode and
use "\n" in the input line:

For example, if file contains lines

aaa
bbb

search string should be "aaa\nbbb".

As a side effect, non-printable ASCII symbols (\r, \t, etc) in the
search string can be used too.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-14 18:02:23 +03:00
Andrew Borodin 12543835f9 (edit_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:56:31 +03:00
Andrew Borodin 390d614b5e (group_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin ccdc909105 (widget_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:03 +03:00
Andrew Borodin 5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin bf0dd8efb1 WInput: use GString for buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:28:51 +03:00
Adam Sampson 7435010d29 Ticket #4358: tests/lib/strutil/filevercmp.c: variable redeclaration.
(filevercmp_test5): rename variables. START_TEST macro uses the variable
name _i, so GCC complains about redefining it with a different type
here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin dc67246c27 Ticket #4374: fix file sort by version.
filevercmp: don't treat entire filename as suffix.

Sync with gnulib 1ba2b66ea45f9bc43cdc0f6f93efa59157d2b2ba.

(file_prefixlen): When stripping (\.[A-Za-z~][A-Za-z0-9~]*)*$ suffixes,
do not strip the entire file name.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-04 09:01:43 +03:00
Andrew Borodin 7408272361 filevercmp: fix several unexpected results.
Sync with gnulib 9f48fb992a3d7e96610c4ce8be969cff2d61a01b.
Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin d00a1c22b9 tests/lib/strutil/filevercmp.c: use _GL_CMP() to get sign.
tests/lib/strutil/str_verscmp.c: likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 39e7a048f7 tests/lib/strutil/filevercmp.c: minor improvements.
Use ck_assert_int_lt() and ck_assert_int_gt() to check integer values.

Increase minimal version of Check up to 0.9.10.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 4f22598c9a Tests: clarification of boolean values tests.
Use mctest_assert_true and mctest_assert_false macros to check boolean
values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin f411d44fea Tests clean up.
Remove mc-specific macros mctest_assert_int_eq and mctest_assert_int_ne.
Use ck_assert_int_eq() and ck_assert_int_ne() functions respectively.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin 89d8fa4ac1 Ticket #1: remove SMB suport.
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-26 10:03:49 +03:00
Andrew Borodin b77961a14d mcedit: move all completion-related stuff to editcomplete.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin de16ae9180 Use G_OPTION_ENTRY_NULL macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 2cd33ad0d5 Convert widget coordinates from global to local and vice versa.
Add two widget callbacks:
  * (make_global): convert widget coordinates from local (relative to
    owner) to global (screen).
  * (make_local): convert widget coordinates from global (screen) to
    local (relative to owner).

Such conversions are required when nested widgets and groups are added to
or removed from another groups.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 4df5bbf9ef Fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 20:15:00 +03:00
Andreas Mohr fa8c5e1c37 libcheck: replace deprecated fail_unless() function.
libcheck fail_unless() is deprecated since 0.10.0.
Also fix -Wformat-extra-args warnings.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:25 +03:00
Andreas Mohr da97a2a626 libcheck: replace deprecated fail() function.
libcheck fail() is deprecated since 0.10.0.
Also fix -Wformat-extra-args warnings.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:25 +03:00
Andreas Mohr 79fb2be8d1 (hex_translate_to_regex.c): fix maybe-uninitialized warning.
hex_translate_to_regex.c: In function 'test_hex_translate_to_regex_fn':
hex_translate_to_regex.c:172:9: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  172 |         mctest_assert_int_eq (error, data->expected_error);
      |         ^
hex_translate_to_regex.c:154:33: note: 'error' was declared here
  154 |     mc_search_hex_parse_error_t error;
      |                                 ^

Found by gcc-9.3.0

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andreas Mohr 7b9c9564e8 Fix lto-type-mismatch warning.
Found by gcc-9.3.0.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin d88f439a69 (mc_g_string_dup): new API that extends GString one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:57:24 +03:00
Andrew Borodin 6f859e52d0 (file_entry_t): use GString instead of fname & fnamelen.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin 536fb676d8 (vfs_path_free): add 2nd parameter...
...to free or not to free the string representation
of vfs_path_t object.

It allows to get rid of string duplication in following cases:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = g_strdup (vfs_path_as_str (vpath));
vfs_path_free (vpath);

Now we can write:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = vfs_path_free (vpath, FALSE);

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin 0c02118fad Define macros for bashrc, ashrc, and inputrc files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin 9ee52e77c3 Ticket #4179: code clean up before 4.8.27 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin a10bf6a244 (mc_pstream_get_string): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:17:08 +03:00
Andrew Borodin 6cc697beff Add test for new ftp parser.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:02:12 +03:00
Andrew Borodin 76847e08fd Ticket #4203: support custom .zshrc.
Custom .zshrc file is  ~/.local/share/mc/.zshrc.

If ZDOTDIR environment variable is not set, set it to ~/.local/share/mc
if a .zshrc is found there. It is the only way to point zsh to an other
rc file than the default.

Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:17:31 +03:00
Andrew Borodin 285eb5c186 Ticket #3682: drop automatic migration of configuration
...from ~/.mc to XDG-base.

Now MC ignores ~/.mc directory and uses XDG-based only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-22 21:16:52 +03:00
Andrew Borodin ba6b42802f Ticket #4154: support unrar v6.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-13 16:52:07 +03:00
Andreas Mohr 631cf4f3bf Ticket #3986: tests: do not write parallel to logfile.
Since automake-1.12 (test-driver script) libcheck logfile is written
parallel by automake.
Print test logging to stdout and let write to logfile by automake only.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:58:45 +03:00
Andrew Borodin 2420b7180b editor: completing from all open files.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:37:36 +03:00
Andrew Borodin 29720d04ab editor: word completion: refactoring.
(edit_collect_completions): return GQueue. Use GQueue inside.
Do not return an empty queue, create it if needed only.

(edit_complete_word_cmd): Use GQueue inside. Ged rid of limitation
of completions count. Rename variable.

(editcmd_dialog_completion_show): take GQueue. Rename and reorder
arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:37:13 +03:00
Andrew Borodin c1ed403c02 tests/lib/strutil/Makefile.am: remove unsed include path.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin d37dbcca4c Move cd_to() to separate file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin 344af14029 Refactoring: rename functions
_do_panel_cd -> panel_do_cd_int
do_panel_cd -> panel_do_cd
do_cd -> panel_cd
do_cd_command -> cd_to

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin e3519f8966 (do_cd_command): refactoring: get path only
...instead of command "cd path".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin 6f96cad1ca (examine_cd): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin 819e0908f6 src/filemanager/ext.c: minor refactoring.
(exec_get_export_variables): return GString.
(exec_make_shell_string): likewise.
(exec_extension): exec_get_export_variables() and
exec_make_shell_string() retur GString now.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin 0e272b9e90 (do_cd): get rid of global variable current_panel usage...
...and related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin 41a35b9b8a Rename files:
src/filemanager/midnight.[ch] -> src/filemanager/filemanager.[ch].

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin 78893d85b8 Drop mc_timer. Use g_get_real_time() instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-12 20:39:01 +03:00
Andrew Borodin fc26346cdb tests: extfs/zip: file names with leading space or dash.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-21 14:48:06 +03:00
Andrew Borodin 03b9af4e5d Revert "urar extfs: don't start path with ./ in file list."
This reverts commit 6dc337ff90.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-21 14:48:06 +03:00
Andrew Borodin b814b3dd02 extfs/uzip: add leading ./ to file name
...to handle files with name started with space or dash.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-21 14:48:06 +03:00
Andrew Borodin 562889ce1e Rename macro MC_SKINS_SUBDIR to MC_SKINS_DIR.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00