Commit Graph

1976 Commits

Author SHA1 Message Date
Andreas Mohr
db3b30ebea (mc_serialize_config): fix memory leak.
Found by Coverity.
Coverity id #331818.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
6efddd7380 (vfs_findgid): fix overrunning string.
Fix out-of-boundary access to gname if it's shorter than 255 bytes.

Found by Coverity.
Coverity id #331844.

Fix macro name that is used for array size.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
2dfdc6d690 (vfs_finduid): fix overrunning string.
Fix out-of-boundary access to uname if it's shorter than 255 bytes.

Found by Coverity.
Coverity id #331835.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
b6a169cc24 (mc_skin_color_parse_ini_file): fix memory leak.
Found by Coverity.
Coverity id #331849.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
91b7101e06 (DOZ): new macro: difference or zero.
Use DOZ where appropriate.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
d35df9ad60 Use argument names in function declarations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
07837de33b (is_exe): simple refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +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
231c84caeb Widget: implement destroy callback.
(dlg_destroy): remove. Use widget_destroy() to destroy any dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin
e7fab254f9 Rename variable: midnight_dlg -> filemanager.
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
Andreas Mohr
b71f66dbbd Fix const/unconst casts.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin
0a26014ca4 m4.include/mc-with-screen-slang.m4: check S-Lang using pkg-config only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
8d84972533 (extfs_get_archive_name): fix -Wcast-qual warning.
extfs.c:799:24: warning: cast from 'const struct extfs_super_t *' to 'struct vfs_s_super *' drops const qualifier [-Wcast-qual]
        archive_name = VFS_SUPER (archive)->name;
                       ^
../../../lib/vfs/xdirentry.h:39:46: note: expanded from macro 'VFS_SUPER'
#define VFS_SUPER(a) ((struct vfs_s_super *) (a))
                                             ^

Found by Clang-11

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr
e68c2f8c1b Ticket #4179: code cleanup before 4.8.27 release.
lib/widget/group.c: fix -Wcast-qual warnings:

group.c:199:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
        for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                    ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
                            ^
group.c:231:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
        for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                    ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
                            ^
group.c:263:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
        for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                    ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
                            ^

Found by Clang-11.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Grzegorz Szymaszek
3a6725bdb7 Ticket #4251: add foot to the known terminals
foot is a "fast, lightweight and minimalistic Wayland terminal emulator"
(see https://codeberg.org/dnkl/foot). Add its default TERM value to the
recognized ones. This enables mc to change the terminal window title and
handle mouse events.

(tty_check_term): add support of foot terminal emulator as xterm-compatible.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-30 13:17:07 +03:00
Andrew Borodin
9132211575 (tty_check_term): clarify description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-29 13:50:30 +03:00
Grzegorz Szymaszek
2f3d59db36 Ticket #4248: add alacritty to known terminals.
Alacritty is a "fast, cross-platform, OpenGL terminal emulator" (see
https://github.com/alacritty/alacritty). Add its default TERM value to
the recognized ones. This enables mc to change window title and handle
mouse events.

(tty_check_term): add support of alacritty terminal as xterm-compatible.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-29 13:43:52 +03:00
Andrew Borodin
53d073758f WMenubar: remove unneeded action.
(menubar_activate): do not focus explicitly. Focus is made in
widget_select().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:14 +03:00
Andrew Borodin
913403b10c Buttonbar: use WST_VISIBLE state
...instead of WButtonBar::visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:10:08 +03:00
Andrew Borodin
0e75e85598 Menubar: use WST_VISIBLE state
...instead of WMenuBar::is_visible member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:09:53 +03:00
Andrew Borodin
7196a15d81 Add WST_VISIBLE widget state.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:06:28 +03:00
Andrew Borodin
4598667b4d Ticket #2919: implement WST_VISIBLE widget state.
(widget_is_focusable): new widget API.
Use it to detect if widget can take focus or not.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:06:28 +03:00
Andrew Borodin
30480df7c9 Rename version.h to mc-version.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andrew Borodin
32621b96d1 Ticket #2252: reduce rebuld time.
The build system runs configure script after switching to another branch
or changeset, which basically means that each git operation which
modifies HEAD will cause a full rebuild. This is highly annoying, in
particular during bisecting.

Solution:
Don't define version in config.h.
Add mc_version member to mc_global_t structure and use it instead of
VERSION macro.
Now only lib/global.c depends on MC version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 16:58:31 +03:00
Andreas Mohr
3c287cef95 Ticket #4222: fix segfault in search.
(mc_search__g_regex_match_full_safe): fix out of bound read:
g_utf8_get_char_validated() expects a nul-terminated string.

Test case: search for "test" in
https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-20201218.tar.xz

Found by clang-11

==10142==ERROR: AddressSanitizer: SEGV on unknown address 0x60c001e00000 (pc 0x7ffb352111c0 bp 0x7ffcb5745150 sp 0x7ffcb57450e8 T0)
==10142==The signal is caused by a READ memory access.
    #0 0x7ffb352111c0 in g_utf8_get_char_validated (/usr/lib64/libglib-2.0.so.0+0x811c0)
    #1 0x851e6d in mc_search__g_regex_match_full_safe /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:297:22
    #2 0x851824 in mc_search__regex_found_cond_one /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:328:10
    #3 0x84b955 in mc_search__regex_found_cond /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:377:13
    #4 0x84aa07 in mc_search__run_regex /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/regex.c:955:17
    #5 0x848969 in mc_search__run_normal /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/normal.c:104:12
    #6 0x77270c in mc_search_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/search/search.c:308:15
    #7 0x514fd9 in search_content /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1123:20
    #8 0x511917 in do_search /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1405:26
    #9 0x512028 in find_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1597:9
    #10 0x7e285f in send_message /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:243:15
    #11 0x7e36d8 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:307:17
    #12 0x7e34c5 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:583:5
    #13 0x510aa1 in run_process /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1755:11
    #14 0x50c29e in do_find /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1789:20
    #15 0x5098e7 in find_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/find.c:1917:17
    #16 0x504735 in midnight_execute_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1251:9
    #17 0x502e00 in midnight_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1604:21
    #18 0x7eaa5c in send_message /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/../../lib/widget/widget-common.h:243:15
    #19 0x7e7ae9 in group_handle_key /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:442:19
    #20 0x7e6a4f in group_default_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/group.c:567:16
    #21 0x7e31bf in dlg_key_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:251:19
    #22 0x7e2c12 in dlg_process_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:549:9
    #23 0x7e3746 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:320:9
    #24 0x7e34c5 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:583:5
    #25 0x502866 in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filemanager.c:1838:16
    #26 0x4ceb15 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:455:21
    #27 0x7ffb34f16b49 in __libc_start_main (/lib64/libc.so.6+0x23b49)
    #28 0x4230f9 in _start (/tmp/portage/app-misc/mc-9999/work/mc-9999/src/mc+0x4230f9)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-03 12:33:54 +03:00
Andrew Borodin
4faf4cb2d7 (widget_set_size): call widget_draw() to get rid of code duplication.
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
2ab7fd0390 (struct key_config_t): remove.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
fb3ea27299 (struct name_keymap_t): move from lib/keybind.h to lib/keybind.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
faa195ae59 (mc_tmpdir): use $MC_TMPDIR if set. 2021-03-14 19:48:59 +03:00
Andrew Borodin
4cbc61a775 Clarify check of 256 colors support.
(tty_use_truecolors): don't check 256 colors here.
(tty_use_256colors): generate error message if 256 colors aren't
supported.
(tty_init): sync with modified tty_use_256colors().
(tty_color_try_alloc_pair_lib): likewise.
(mc_skin_init): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:48:59 +03:00
Andrew Borodin
7acf07ee6e (str_convert_to_input): make inline.
(str_convert_to_display): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
f4b1c0a4d0 (parse_256_or_true_color_name): pacify gcc-10.2.
Fix warnings:

lib/tty/color-internal.c: In function 'tty_color_get_index_by_name':
lib/tty/color-internal.c:156:19: warning: '[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
  156 |             i = (h[0] << 20) | (h[1] << 16) | (h[2] << 12) | (h[3] << 8) | (h[4] << 4) | h[5];
      |                  ~^~~
lib/tty/color-internal.c:156:34: warning: 'h[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
  156 |             i = (h[0] << 20) | (h[1] << 16) | (h[2] << 12) | (h[3] << 8) | (h[4] << 4) | h[5];
      |                                 ~^~~
lib/tty/color-internal.c:156:49: warning: 'h[2]' may be used uninitialized in this function [-Wmaybe-uninitialized]
  156 |             i = (h[0] << 20) | (h[1] << 16) | (h[2] << 12) | (h[3] << 8) | (h[4] << 4) | h[5];
      |                                                ~^~~

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
452074906a (str_replace_all): use g_ptr_array_new_with_free_func().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
a309e1e133 (str_ptr_array_join): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
daf21d8315 Clarify init and destroy of dialog.
(group_default_callback): NULLify list of widgets after destroy.

(dlg_default_callback): do nothing in MSG_INIT and MSG_DESTROY handlers.

(dlg_destroy): send MSG_DESTORY to dialog to allow it destroy it's
private data. MSG_DESTROY is a last message sent to dialog before
desctuction.

(edit_dialog_callback): use MSG_DESTROY instead of MSG_END to deinit
editor.

(midnight_callback): use MSG_DESTROY instead of MSG_DESTORY to deinit
file manager.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
c96875fa9f Fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +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
03029ff6da (open_error_pipe, close_error_pipe): remove.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:17:08 +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
1e45efecb2 (mc_popen): add two parameters:
do or don't read stdout of child process;
do or don't read stderr of child process.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:17:07 +03:00
Andrew Borodin
68556db80d Ticket #4191: unable to browse tar.xz archives.
Initial commit: revert "(open_error_pipe): fix resource leak."

This reverts commit 61f997de26.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:17:07 +03:00
Andrew Borodin
02989d4d84 Ticket #2841: ftpfs: new filelist parser.
Initial step: minor refactoring:
  * (vfs_parse_month): rename from is_month() and make global.

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
Marek Černocký
c8649068d3 Ticket #4194: add .c++ and .h++ extensions for highlight.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-18 16:52:21 +03:00
Sergei Trofimovich
6394547dbf Ticket #4192: fix crash if shadow is out of screen.
(tty_clip): add extra tests for area boundaries.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-03 09:47:13 +03:00
Andrew Borodin
ba62dd32ad Ticket #4181: FTBFS against NCurses on OS X 10.9.5.
lib/tty/tty-ncurses.h: define _XOPEN_SOURCE_EXTENDED to use cchar_t,
getcchar(), setcchar().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-24 14:19:22 +03:00
Andreas Mohr
40b96b67dd (x_basename): the NULL check is unnecessary...
...because the pointer can't be NULL.

Found by Coverity.
Coverity id #110817.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
61f997de26 (open_error_pipe): fix resource leak.
Save file handle for later close, if valid.

Found by Coverity.

Coverity id #32607.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
9d8cd79dde (mouse_get_local): fix uninitialized scalar variable.
Found by Coverity.

Coverity id #32631.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
57f5ab7c23 Add break before empty default in switch.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
9040cc3476 Fix typos. 2020-12-31 16:26:46 +03:00
Andrew Borodin
4fd2706f47 lib/dialog.h: include "lib/keybind.h" (due to global_keymap_t).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin
cc470c615a (tty_clear_screen): rename from clr_scr and move to lib/tty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin
1869dffd14 Ticket #4103: code cleanup before 4.8.26 release.
Initial step: rename keymap sections:
  main -> filemanager
  main:xmap -> filemanager:xmap

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin
f8d73e7a95 Ticket #4152: WInput: keep "first" state...
if history or completion window was cancelled.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-23 15:25:55 +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
4a83daacc4 Ticket #4147: VFS timestamps: use g_get_real_time().
In the function vfs_expire(), curr_time and exp_time are declared
guint64. curr_time is initialised with a timestamp and exp_time
with this timestamp minus vfs_timeout seconds. Later there is if
(stamping->time <= exp_time). Prior to commit
a94dd7d2de curr_time was initialised with
a value larger than vfs_timeout seconds, so everything was fine. This
commit changed the initialisation to a timer starting when mc is
started. So for the first vfs_timeout seconds, the result of the
subtraction is negative, but it is a guint64, so we just get a VERY
large unsigned value and the if (stamping->time <= exp_time) is always
true. So mc thinks the vfs hasn't been used recently and goes into an
infinite loop.

If one opens a .rpm file with mc and goes into the CONTENTS.cpio and
then tries to go into the .tar.gz there (this is the usual structure of
a .rpm) after waiting vfs_timeout seconds, everything is fine. However,
before vfs_timeout seconds, mc hangs.

Solution: use g_get_real_time() instead of mc_timer_elapsed().

Thanks nvwarr at hotmail.com for finding out the reason for this bug.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-12 20:39:01 +03:00
Andrew Borodin
01f096f52f (mc_g_string_copy): new API that extends GString one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-12 20:23:05 +03:00
Andrew Borodin
4c7223e9f2 Ticket #4145: file names longer than 255 bytes are not supported.
Avoid limitation of file name length.

(vfs_dirent): redefined to use instead of standard "struct direct"
to hold file name of any length.
(vfs_class::readdir): return newly allocated vfs_dirent structure.
Related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-12 20:23:05 +03:00
Andrew Borodin
258e6bcd57 Ticket #4142: ctrl-l shortcut (refresh screen) is broken.
This bug was introduced in 2e734e5618.

(dlg_handle_key): fallback to dialog_map if shortcut is not defined in
filemanager/editor/viewer/diffviewer key map.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-21 14:54:27 +03:00
Andrew Borodin
5bf714b008 Ticket #4131: use G_UNICODE_SPACING_MARK instead of G_UNICODE_COMBINING_MARK.
G_UNICODE_COMBINING_MARK is deperecated in glib >= 30.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-15 15:16:24 +03:00
Andrew Borodin
3143196247 mc_timer: use g_get_real_time() instead of gettimeofday().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-13 16:34:55 +03:00
Andrew Borodin
c5c561274b Remove Cray support.
Sync with gnulib dea936112710e82dd42ffbea510f3bb644acdaaa.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-13 16:34:55 +03:00
Andrew Borodin
375839d657 Optimize comparisions in file sort functions.
Use three-valued comparison macro from gnulib
efa15594e17fc20827dba66414fb391e99905394.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-13 16:34:55 +03:00
Andrew Borodin
2dc692c76b Create command_names using macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-13 16:34:47 +03:00
Andrew Borodin
794f94cb23 lib/tty/tty-ncurses.c: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-08-05 10:49:50 +03:00
Andrew Borodin
8b4386df83 Ticket #4120: draw shadows for dialog boxes and menus.
Thanks Aleš Janda <ales.janda@kyblsoft.cz> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-08-02 16:13:26 +03:00
Andrew Borodin
c7fc6c9718 Ticket #4099: In subshell on Solaris 11.4 SPARC terminal size is always 80x24.
In Solaris 11.4 SPARC, TIOCSWINSZ is defined in termios.h.

lib/tty/tty.c: add #include <termios.h>, because TIOCSWINSZ is used in
tty_resize().

Thanks Alexander <shurik005@gmail.com> for the fix.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-06-24 19:57:02 +03:00
Egmont Koblinger
8877d218dd Ticket #4063: fix mouse handling in old terminal emulatres
...like KDE3 Konsole.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-06-16 21:58:25 +03:00
Egmont Koblinger
b92c7f86b4 Ticket #3954: fix mouse handling with newer terminfo entries.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-06-07 18:37:41 +03:00
Andrew Borodin
dffe01fab1 (hline_set_textv): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +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
Andrew Borodin
246bdd63b4 lib/mcconfig/paths.c: cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
b65a951ee4 Clean up files unused by mcedit anymore.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
81b1f47e01 Rename macros with editor-related file locations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
4c43c29aca lib/widget/dialog.h: remove unused typedef.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
570f5c1875 lib/widget/background.c: fix comment.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
4675793e7c (listbox_remove_current): remove extra type casting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
3945f5fdf6 (listbox_callback): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
c9e2a4400e Input complete: refactoring.
* (complete): rename to input_complete() and move declaration to
  input.h.
  * input_complete.h: remove.
  * (input_free_completions): rename to input_complete_free() and move
  definition to input_complete.c.
  * lib/widget/input_complete.c: rename variables and function from
  query_* to complete_*.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
178f88bdd9 input_complete.c: (query_callback): use widget_lookup_key().
(input_key_is_in_map): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin
2f22ce9434 menu: CK_* constants are signed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:18 +03:00
Andrew Borodin
946e8d4888 Ticket #212: implement keybindings for radiobuttons.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:18 +03:00
Andrew Borodin
28574f8008 (vfs_s_subclass::dir_uptodate): return gboolean instead of int.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:18 +03:00
Andrew Borodin
9581c263b2 VFS: use mc_timer for timestamps.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:18 +03:00
Andrew Borodin
a94dd7d2de VFS GC: use mc_timer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:18 +03:00
Andrew Borodin
b9cf2898c4 Ticket #4057: blank screen with invisible error.
How to reproduce:
Run `mcedit .` from an empty shell. mc used to show an error banner. Now
it shows black-on-black error message.

do_refresh() function expects that at least one fullscreen dialog (file
manager, editor, etc) is existing in the dialog stack. If query dialog
is created before any fullscreen one, do_refresh() do nothing.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-11 10:43:05 +03:00
Andrew Borodin
e14d44c839 Ticket #3847: chattr command implementattion.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-05 19:06:18 +03:00
Andrew Borodin
cef0bb0138 Fix segfault in case of click on widget that doesn't handle mouse.
Use default mouse callback function if widget doesn't handle mouse.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-04-03 16:53:15 +03:00
Andrew Borodin
bcdd81c628 WGroup: support colors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
d38eb77c8c WGroup: support state.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
f0e13d8fba Make WST_CONSTRUCT a default widget state. 2020-03-08 20:17:32 +03:00
Andrew Borodin
f39f05632a WGroup: support key events.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
2e734e5618 Make keybind map a member of Widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
326c4ce1d9 (dlg_key_event): clarify post-hotkey handling.
Current widget is the sender of MSG_UNHANDLED_KEY message.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
c2aadb2ad5 WGroup: support mouse events.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
4b3b49faad (widget_draw): support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
d1f9e698ac WDialog: use WBackground in frameless dialogs (screens).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin
a87f1e7bf6 Create WBackground widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:29 +03:00
Andrew Borodin
ed9199e94e Create WFrame widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:02 +03:00
Andrew Borodin
c77dc88ff9 WGroup: support draw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin
2a265e38a0 WDialog set/change size API: move to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin
04f04ba130 Send new widget size as parameter of MSG_RESIZE message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin
045816ed13 (dlg_set_position): use WRect.
(widget_set_size_rect): new API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin
d13a28a91d Create WRect class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:34 +03:00
Andrew Borodin
6acd8475dd Update cursor API: support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:13:35 +03:00
Andrew Borodin
206baa8b9a (widget_is_active): support groups. 2020-03-08 20:13:35 +03:00
Andrew Borodin
95b4a86d44 (dlg_get_current_widget_id): rename to group_get_current_widget_id.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:13:35 +03:00
Andrew Borodin
e9d23e90f0 Find widget API: support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:13:33 +03:00
Andrew Borodin
fdf3d9c3b7 WGroup: implement init & destroy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:12:45 +03:00
Andrew Borodin
5ce511e07e Implement uniq widget ID for each widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin
b9cf650605 Move send broadcast message API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin
74c510f4fb Widget and WGroup API changes:
* (widget_destroy): new API to destroy widget.
  * (group_del_widget): rename to group_remove_widget. Don't destroy
  widget after remove it from group.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin
22ad70ed02 Move widget add/del API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin
6eedbce076 Move widget selection API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:39 +03:00
Andrew Borodin
d575c7058b Move winch_pending member from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:09:13 +03:00
Andrew Borodin
e4e0070db5 Ticket #2919: implement WGroup widget.
WGroup is the base widget for complex objects such as windows, dialog
windows, etc.

Initial steps:
  * move widget list of dialog into WGroup class;
  * inherit WGroup from Widget;
  * inherit WDialog from WGroup.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:09:12 +03:00
Andrew Borodin
dff8ee2981 (get_key_code): yet another refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
78b01cdf87 (get_key_code): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
444ec92d81 (get_key_code): fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
97eb8faab0 (mc_skin_lines_load_frm): cleanup, fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
f9cb0ba79f lib/vfs/parse_ls_vga.c: refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
65a7278d8a lib/vfs/parse_ls_vga.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
86ba1d78b7 lib/vfs/parse_ls_vga.c: use gboolean instead of int for boolean values.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
31b37a1f79 Ticket #4050: code cleanup before 4.8.25 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
ac184ebafe Ticket #4064: fix garbage in history.
(do_show_hist): apply new input history and current postition to avoid
use-after-free after call of history_show().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-21 18:24:59 +03:00
Andrew Borodin
9a57984974 Close sigwinch_pipe at shutdown.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-08 19:35:36 +03:00
Andrew Borodin
b5dae72e1e (tty_create_winch_pipe): use GLib APIs to create pipe
...to get rid of OS-specific features and limitations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-08 19:35:36 +03:00
Andrew Borodin
91688ab76e Ticket #4052: reimplement SIGWINCH handling.
Bump minimum GLib requirenment to 2.30.0.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-08 19:35:36 +03:00
Andrew Borodin
c867b9d40e Ticket #5056: avoid subshell warning for mcedit run from mc.
Don't show message "GNU Midnight Commander is already running on this
terminal. Subshell support will be disabled." if standalone
mcedit/mcview/mcdiffview is run from mc. Show this message only in case
of mc run from another mc, as was before commit
41abcbf706 (ticket #3380).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-08 19:26:49 +03:00
Andrew Borodin
b75ee9169e Ticket #4053: fix FTBFS with glib2 >= 2.63.3.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-01-24 21:23:24 +03:00
Andrew Borodin
28ca5cb128 Ticket #4052: fix FTBFS on OSes w/o O_CLOEXEC.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-01-22 10:44:19 +03:00
Andrew Borodin
d034500fd6 (button_set_text): do nothing if new and current texts are equal.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
b031b44823 (check_set_text): new WCheck API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
432af88b06 (hotkey_draw): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
53314c58b5 (hotkey_get_text): new hotkey API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
851d2022a9 (hotkey_equal): new hotkey API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
32a4b1ac85 Rename hotkey API:
* parse_hotkey to hotkey_new;
  * release_hotkey to hotkey_free.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
b2141c0ff0 Ticket #4039: split integer and boolean layout options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 13:02:31 +03:00
Andrew Borodin
57c303eeaf Use g_clear_slist() and g_clear_list().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
f85c1c898e lib/widget/menu.c: constify some function arguments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
65e12d1a9f (dlg_redraw): rename to dlg_draw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
60fe701b76 (widget_redraw): rename to widget_draw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
35f14be028 (widget_move): rename to widget_gotoyx.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
baca4ba045 Widget and WDialog API changes:
* (widget_destroy): new API to destroy widget.
  * (del_widget): don't destroy widget after remove it from dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin
093571938a Ticket #4035: fix compile failure on OS X 10.9.
Fix duplication of menu_map definition.

Move menu_map definition to lib/widget/menu.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-11-23 17:41:58 +03:00
Andrew Borodin
68d9961977 Ticket #4022: fix compile failure on AIX 7.2.
Rename MC VFS flags to avoid name conflicts with system-wide VFS flags
on some OSes (such as AIX).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-11-18 21:27:56 +03:00
Andrew Borodin
0dacce4228 Do not include <sys/select> globally via "lib/global.h".
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
7a602de0d2 (mc_symlink): test vpath2 before use.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
4667a9be0d lib/vfs/interface.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
8411b93ff7 (vfs_stamp_compare): fix NULL dereference.
(vfs_stamp): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
7ce3ca0991 Make VFS faster a bit.
Each VSF entry is added to VFS using vfs_s_insert_entry() via
g_list_append(). For long lists, a lot of walking through entire list
is performed. To get rid that, change type of vfs_s_inode::subdir from
GList to GQueue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
a5826c3f6e (vfs_s_normalize_filename_leading_spaces): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
21376ec1e9 (history_show): fix order of history items.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 15:11:53 +03:00
Andrew Borodin
3c4fe21108 Ticket #4019: fix SIGWINCH handling,
Fix regression introduced in 37ffc02422.

(tty_got_winch): don't read FIFO, just check whether it os empty or not.
It can be called many times without lost of info about SIGWINCH raises.
(tty_flush_winch): read from FIFO to make it empty.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-29 11:21:14 +03:00
Sergei Trofimovich
f30e6ff283 Ticket #3629: configure.ac: drop bundled gettext
Bundled libintl did not support linking to internal static
libraries (libmc in our case): directly specified static
libraries are not pulled by libtool and are not usable for
dynamic libraries as PIC-related flags are not passed for
compilation.

This renders bundled libintl library unusable.

The change drops libintl bundling support and always relies
on external libintl (or falls back to disabled NLS).

On a related note gettext-0.20 drops support for bundling
or libintl and this change will ease migration to newer version.

The change is tested on x86_64-gentoo-linux-musl: mc builds
and links all tests successfully. A few tests fail for lack
of NLS support.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-22 13:10:46 +03:00
Egmont Koblinger
6a5d4243ce Ticket #4013: menubar: fix mouse click coordinate.
In the menu bar, click on the space character immediately before the
"File" label.

Actual: The "Left" menu opens.

Expected: The "File" menu should open, since when clicking on "File",
this space character on its left is also highlighted.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-08 11:41:25 +03:00
Andrew Borodin
13597ebd67 lib/tty/tty-internal.h: fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
eb2943aed2 (tty_init): remove stuff that SLang_init_tty() already done. 2019-09-01 19:41:12 +03:00
Andrew Borodin
f22353ed3d (tty_init): clarify screen size limitation.
S_Lang: pre2.3.3-8 (55f58798c267d76a1b93d0d916027b71a10ac1ee): removed
static buffers dependent upon SLTT_MAX_SCREEN_ROWS/COLS in favor of
dynamically allocated arrays.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
297391fd60 (dlg_adjust_position): rename to widget_adjust_position and make public.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
2b55c54efc Menubar is always on top line of screen.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
247af01a8e (toggle_panels): join with view_other_cmd and rename to toggle_subshell.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
29110e5681 Move history operation routines from lib/widget/history.c to lib/mcconfig/history.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
0efb799db3 lib/mcconfig: fix coding style; apply source file template.
Unconstify some function arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin
37ffc02422 Ticket #117: refactoring of SIGWINCH hangling.
Use pipe to collect consecutive raised SIGWINCH events.
Then handle multiple events at a time treating them
as a single one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:22:21 +03:00
Andrew Borodin
c4668b56f7 history: refactoring.
Prepare to support CK_Delete in editor and viewer history.
The filepos file contains file positions and bookmarks. We must keep
them.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
883e7b17b5 (listbox_get_length): new WListbox API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
0f02d49b0d (history_show): port to WListbox keybindings.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
a4e36d079d WListbox: add Edit, View and Enter keynindings.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
b81e4aac55 (history_show): rename variable.
(history_dlg_data): rename member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
644d72fed2 (history_show): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-08-10 09:45:27 +03:00
Andrew Borodin
2fce07a7e1 (listbox_set_list): change argument type. 2019-08-10 09:45:27 +03:00
Ilia Maslakov
87428aa8ea added new keybindings (F3, F4) in history list.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2019-08-10 09:45:27 +03:00
Ilia Maslakov
3e7b2c49dc Ticket #2733 (a simple list of recently edited files)
Based on patch by Filip Sefrna <fsefrna@gmail.com>
    added action 'EditorHistory' for call history dialog.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2019-08-10 09:45:27 +03:00
Andrew Borodin
76a5f70f5b Ticket #3992: improve support of Windows 1251 encoding on Solaris.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-07-13 08:58:27 +03:00
Andrew Borodin
7eaa51c79b Fix broken hotkeys in menu.
Regression was introduced in f5f78ea658.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-18 09:34:00 +03:00
Andrew Borodin
651c3539b6 VFS: trivial optimization
* (vfs_s_opendir): test if path is invalid or not ASAP.
  * (vfs_s_readlink): likewise.
  * (vfs_s_open): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
9df841478b VFS: move flush member from vfs_s_subclass to vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
45bd20ab0b VFS: move logfile member from vfs_s_subclass to vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
94c0b79f37 VFS: change vfs_class::nothingisopen members
Do not free VFS before nested one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
5b0f177e62 vfs_class::nothingisopen: return gboolean instead of int.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
3d6d6bd9a6 lib/vfs/gc.c: yet another fixups
* (vfs_expire): refactor.
  * Fix typos.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
7548679271 VFS: invalidate file descriptors after close.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
210ccc2f65 (vfs_path_from_str_uri_parser): get rid of extra type cast.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-15 17:43:00 +03:00
Andrew Borodin
ff7d1728e2 Menubar: support Home and End actions for Menubar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-09 12:06:10 +03:00
Ilia Maslakov
4e5488d5b2 Menu: implement drop/execute menu by hotkey.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-09 12:06:10 +03:00
Ilia Maslakov
f5f78ea658 Ticket #212: implement keybinding for menu.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-06-09 12:06:10 +03:00
Andrew Borodin
7ddd4e9bb4 Ticket #3452: mcviewer: implement temporary change of search direction.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 20:47:51 +03:00
Andrew Borodin
8724c80b7a lib/tty/key.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:31:20 +03:00
Andrew Borodin
c6f269a2c3 lib/tty/key.c: (SelectList): rename to select_t and refactor using GSList.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:25 +03:00
Andrew Borodin
0c66d9cef6 extfs: refactoring: use standard VFS structures.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:25 +03:00
Andrew Borodin
533cbbd971 VFS: make vfs_file_handler related macros more readable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
6d21416672 VFS: derive VFS-specific file handler class from vfs_file_handler_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
3e08cc7226 VFS: derive VFS-specific super class from vfs_s_super.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
d51f1f4963 VFS: refactor VFS unit initialization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
672ba46c8b VFS: make vfs_class and vfs_s_subclass related macros more readable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
0fbd98fece Join vfs_class_flags_t and vfs_subclass_flags_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
c764d60238 VFS: (vfs_s_subclass): derive from vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
f11c78f9d0 (vfs_unregister_class): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
45b10aed6b VFS GC: fixups of reimplement using GSList.
Fixups for commit f45ea691db.
Don't use g_list_foreach() for list that is being modified.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
28cdea55cd Revert "VFS GC: use mc_timer."
This reverts commit f21f27c5ae
to fix an unexpected segfaults.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Andrew Borodin
3b997974ec Refactor dialog command execution. 2019-04-27 19:29:24 +03:00
Andrew Borodin
1db894f63c (mc_skin_init): don't check TTY color supports if not required.
Don't check TTY color support if skon doesn't require 256 colors or
true colors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-04-27 19:29:24 +03:00
Mikulas Patocka
d1fd9f2303 Ticket #3208: fix failed gpm connect for vc /dev/tty0.
How to reproduce the bug:

* compile mc with gpm support
* run the gpm daemon on the console
* login to the machine with ssh from console on another machine
* run mc

At this situation, keyboard response will be sluggish and mc will consume
CPU time when idle. The reason is that mc is trying to reopen the Gpm
connection over and over again and gpm will try to close the connection
over and over again (because the user is not on the local console).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-03-24 13:37:26 +03:00
Andrew Borodin
a2a5fa017e Fix file version sort.
Use filevercmp() instead of str_verscmp().
Source code of filevercmp() is taken from Gnulib.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-03-02 11:24:07 +03:00
Andrew Borodin
2163009270 Ticket #3905, 3956: fix file version sort.
* Update str_verscmp implementation: sync with Gnulib.
  * Add tests. Testcases are taken from Gnulib.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-20 15:42:53 +03:00
Andrew Borodin
433ae45bdd Clarify checks of dialog and widget existence.
Widget list in the dialog cannot contain empty elements.
Dialog list cannot contain empty elements too.
Therefore simplify some checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:00 +03:00
Andrew Borodin
f21f27c5ae VFS GC: use mc_timer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:00 +03:00
Andrew Borodin
f45ea691db VFS GC: reimplement using GSList.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:00 +03:00
Andrew Borodin
d451d5978f vfs_stamping: make opaque.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:00 +03:00
Andrew Borodin
7fb06b3105 Use g_queue_clear_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:47:59 +03:00
Andrew Borodin
f4d448629f lib/util.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:47:59 +03:00
Andrew Borodin
1876ef7b84 lib/utilunix.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:47:59 +03:00
Andrew Borodin
1dd8a47987 Ticket #3955: code cleanup before 4.8.23 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:44:40 +03:00
Andrew Borodin
ba6845f2d6 (vfs_stamp_path): get rid of path conversion.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-01-13 12:33:06 +03:00
Andrew Borodin
93f790dc7c Sync with gnulib e96dcbcbc5142bd04c6c2e9e4595d9bea910fb3b.
* m4.include/gnulib/fsusage.m4: (gl_FILE_SYSTEM_USAGE): Don't define
  STAT_STATFS2_FS_DATA.
* m4.include/gnulib/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Don't
  define MOUNTED_GETMNT.
* src/filemanager/filegui.c: remove Ultrix related includes.
* src/filemanager/mountlist.c: Remove STAT_STATFS2_FS_DATA case.
  Remove MOUNTED_GETMNT case.
* lib/tty/tty-internal.h: remove Ultrix-related define.
* src/vfs/smbfs/helpers/include/includes.h: Likewize
* doc/FAQ: Update OS list.
* doc/INSTALL: Likewize.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
654b58d2b5 Sync with gnulib 23671eec22f5221a2dff50942f24c41bcf9caeaf.
fsusage, mountlist: Remove support for Dynix/ptx.

* m4.include/gnulib/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Update comments.
* m4.include/gnulib/ls-mntd-fs.m4 (AC_FUNC_GETMNTENT): Don't test for
  libseq.
  (gl_LIST_MOUNTED_FILE_SYSTEMS): Don't test for MNTTABNAME.
* lib/stat-size.h: Don't mention the Sequent bug.
* src/filemanager/mountlist.c: Don't test for MNTTABNAME. Remove
  _SEQUENT_ case

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
792d25a48b Sync with gnulib 4d4877e6c2123c4862c321f3eab28a55bf886216.
Remove support for AIX PS/2.

* m4.include/gnulib/fsusage.m4: (gl_PREREQ_FSUSAGE_EXTRA): Don't check
  for dustat.h.
* lib/unixcompat.h: Remove code for AIX PS/2.
* lib/stat-size.h (ST_NBLOCKSIZE): Likewise.
* lib/vfs/vfs.c: Likewise.
* src/filemanager/mountlist.c: Likewise.
* src/vfs/smbfs/helpers/include/includes.h: Likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
1fec6e9854 Partially revert "VFS: (vfs_s_subclass): make the derived class from vfs_class."
This reverts commit 5d1284c4a6.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-10 12:47:12 +03:00
Andrew Borodin
c7206191bc Revert "VFS: make VFS-specific super class as derived one from vfs_s_super."
This reverts commit ab033ad318.
2018-09-10 12:47:12 +03:00
Andrew Borodin
c91e3d5edb Revert "VFS: make VFS-specific file handler class the derived one from vfs_file_handler_t."
This reverts commit 2d58e4d624.
2018-09-10 12:47:12 +03:00
Andrew Borodin
88d6157323 (vfs_preallocate): check mc_global.vfs.preallocate_space before call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
669a8e3e17 (dlg_run_done): fix possible NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
b9194d8c8a (dlg_init): fix possible NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
b684ce2565 Clarify usage of FL_NONE value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
eb507862ff (str_ptr_array_join): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
2d58e4d624 VFS: make VFS-specific file handler class the derived one from vfs_file_handler_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
ab033ad318 VFS: make VFS-specific super class as derived one from vfs_s_super.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
5d1284c4a6 VFS: (vfs_s_subclass): make the derived class from vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
a38c7f19e9 Ticket #3453: Find file: show pattern and content in the results dialog title.
Initial step:
    * (dlg_set_title): new API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-04 10:26:35 +03:00
Andrew Borodin
2e5cd866f9 Check linux/fs.h file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-03 09:44:42 +03:00
Andrew Borodin
23a2056a18 (vfs_clone_file): clarify errno in case of bad file descriptors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-03 09:33:32 +03:00
gray_-_wolf
0493a5e90e Ticket #1983: support BTRFS's file clone operation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-03 09:33:32 +03:00
Samuel Bingner
d352220604 Ticket #3930: clarify name of struct stat members for Apple compilation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-08-19 11:37:20 +03:00
Adam Borowski
5eb9bd605e Ticket #3906: ZSTD support.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-03-19 15:00:23 +03:00
Andrew Borodin
566992da32 Ticket #1620: change file highlighting defaults.
Now file highlighting by extension is case insensitive by
default.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-18 12:05:05 +03:00
Andrew V. Samoilov
af8b0ce339 (mc_deserialize_str): trivial optimization.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
dfd6d99e1c (str_8bit_encodings[], str_utf8_encodings[]): make const.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
d70a899c16 (convert_from_8bit_to_utf_c2): use convert_from_8bit_to_utf_c().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
c2e2a33358 lib/charsets.c: fix coding style, trivial optimizations. 2018-02-04 11:30:23 +03:00
Andrew Borodin
c04f8776de (mc_search__recode_str): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
c511968cd4 (mc_search__get_one_symbol): cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
52d1980c46 strutil: character test functions return gboolean instead of int.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
2a973f7a46 Use str_move() where possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
8b6f4ef2c2 Use gboolean instead of int in file/dir sort related functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
d78fc418ec (get_codepage_index): minor optimizations.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
35376105d4 (vfs_url_split): Fix 2 memory leaks found by valgrind.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
6f6c676776 (mc_event_mass_add): make events const.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
af466458b7 vfs: create enum vfs_linear_state_t instead of defines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
95e1ab3064 vfs: use LS_NOT_LINEAR constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
cb354e5490 (vfs_file_handler_t::changed): change type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
a514ce6d13 (vfs_s_super::want_stale): change type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
f1d9b67bb5 lib/vfs/direntry.c: apply cpding style; cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andreas Mohr
6aa2cb1cad (my_systemv): cleanup implicit-fallthrough warning.
Found by GCC 7.2.0

utilunix.c: In function 'my_systemv':
utilunix.c:455:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
             my_exit (127);      /* Exec error */
             ^~~~~~~~~~~~~
utilunix.c:458:5: note: here
     default:
     ^~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
ddd645526a Update copyright years. 2018-02-04 11:30:22 +03:00
Andrew Borodin
a38accd389 (mc_realpath): ignore path encoding.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
6e994011f5 (vfs_path_url_split): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
73979369d1 Support __attribute__((fallthrough)) if possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
b7c54f64bb (vfs_mkstemps): don't allocate a large memory chunk.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
48d85a42b4 achown: add callback for permission buttons
...to change behaviour of WButton objects.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
069306eb2e Ticket #3883: size_trunc_sep() breaks on multibyte locales.
The bug was introduced in b3867a6e15.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-02 14:41:35 +03:00
Andrew Borodin
6310e07745 (button_callback): clean up unneeded type casting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:30 +03:00
Andrew Borodin
3424622d5a (vfs_path_from_str_deprecated_parser, vfs_path_from_str_uri_parser): remove unused flags argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
8715c41a47 (vfs_path_from_str_uri_parser): fix detection of relative path.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
cebede5e84 (diff_two_paths): optimizate path comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
72056890a7 (diff_two_paths): minor optimization: exit loop ASAP.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
02effb2499 (diff_two_paths): reduce variable scopes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew V. Samoilov
bf5abff937 (buttonbar_call): fix possible NULL dereference.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andrew Borodin
7772f00aab Ticket #3780: code clean up before 4.8.20 release.
Direct include <limits.h> for MB_LEN_MAX.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Maksim Dzabraev
16b569986e Ticket #3870: fix INPUT_COMPLETE_CD in quick widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 19:18:23 +03:00
devzero
7f9b333861 Ticket #3616: speed up of utf-8 normalization.
When content of a large directory is being sorted by file names, a
significant amount of CPU time is spent in str_utf8_normalize() that is
called from str_utf8_create_key_gen().

For example, /usr/bin/ contains 5437 files on my Archlinux box. Running
mc /usr/bin/ /usr/bin/ takes approx. 75 000 000 CPU instructions to sort
file names, or 25% of total program run time. From these 75 000 000
instructions, 42 500 000 instruction are spent in str_utf8_normalize().

str_utf8_normalize() uses g_utf8_normalize() to do the work.
g_utf8_normalize() is a heavyweight function, that converts UTF-8 into
UCS-4, does the normalization and then converts UCS-4 back into UTF-8.

Since file names are composed of ASCII characters in most cases, we can
speed up str_utf8_normalize() by checking if the heavyweight Unicode
normalization is actually needed. Normalization of ASCII string is
no-op, so it is effectively "normalized" by just strdup().

With this patch, running mc /usr/bin/ /usr/bin/ requires just 37 000 000
instructions to sort the file names (down from 75 000 000) and 4 500 000
instuctions to do str_utf8_normalize() (down from 42 500 000).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-07-29 10:23:09 +03:00
Yury V. Zaytsev
f0414be51d Zero struct stat tv_nsec (if supported) whenever st is filled manually
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Andrew Borodin
ff1510de1f File panel: unification of terminology.
Use 'list(ing) format' instead of 'list(ing) type' and 'list(ing) mode'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
b56a77e02f Refactoring: handle panel listing mode switch in the panel level
...instead of top level.

Rename and move main/PanelListingSwitch keybind to panel/ListingSwitch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
f4eb2c47c9 Indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 18:54:22 +03:00
Thomas Dickey
4d46a10862 Ticket #3697: (tty_init): unify curses initialization
...for various curses implementations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 14:06:13 +03:00
Yury V. Zaytsev
151b08b412 Ticket #3693: clarify that lack of noreturn attribute is on purpose
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-03-04 18:52:12 +01:00
Yury V. Zaytsev
f09d863ddf Revert "(my_exit): cleanup no attribute noreturn warning."
This reverts commit b91ab44b43.
2017-03-04 18:27:02 +01:00
Mooffie
ac23a4807c Pressing <right> and <left> in hotlist dialog doesn't refresh it.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-26 12:38:39 +02:00
Yury V. Zaytsev
ab4fcb6d30 Revert "Ticket #3687: store the 'hotlist' file in data dir, not config dir."
This reverts commit 306b30ed30.
2017-02-24 21:32:01 +01:00
Mooffie
5ea5c5deb6 Ticket #3760: Fix aborts of MSG_MOUSE_DOWN.
This patch was supposed to get committed as part of #3571 but this never
happened. We commit it now as we depend on its functionality for the next
commit.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 00:04:38 +02:00
Andrew Borodin
e83409b6d7 Ticket #3766: add_widget_autopos() doesn't remove focus from the previously focused widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-02-09 17:49:34 +02:00
Mooffie
bc46978036 (dialog_switch_list): simplify the listbox selector.
We use the new run_listbox_with_data().

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:13 +02:00
Mooffie
11c1aff4d3 Ticket #3763: introduce run_listbox_with_data().
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:04 +02:00
Andrew Borodin
e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Andrew Borodin
28ca14d73a Aggressive use of whitespace() and whiteness() macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
e0c02c9c77 WCheck, WRadio: send MSG_MOTIFY without parameter.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andreas Mohr
469dc1352b (tty_color_get_name_by_index): cleanup format compiler warning.
Found by GCC 6.2.0.

color-internal.c:186:33: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]

Signed-off-by: Andreas Mohr <and@gmx.li>
2017-01-22 18:44:22 +03:00
Andrew Borodin
37de8e6253 (mc_search__g_regex_match_full_safe): don't use negative string length.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
1ff4005228 Use g_queue_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Mooffie
c0abaa6508 (mc_search__cond_struct_new_regex_ci_str): add documentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
8b14798cc4 setup: split integer and boolean options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
c4550374b2 Change type from int to gboolean for variables controlled by checkboxes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00