Commit Graph

1966 Commits

Author SHA1 Message Date
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
ed65694caa quick_dlg: use WRect to hold dialog position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:37:04 +03:00
Andrew Borodin
3978dee37c (widget_set_size_rect): reimplement
...to pass given WRect object directly to widget callback withowt
constuction/deconstuction of intermediate WRect object.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:32:47 +03:00
Andrew Borodin
b265b388aa (input_push_history): join checks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
6aeeb7ffb1 (push history): refactoring.
Rename to input_push_history().

Use input's buffer.

Don't duplicate an empty string, use current one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
6639c4f070 (delete_region): use move_buffer_backward().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
84ec30d05a lib/widget/input.c: reorder routines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +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
Andrew Borodin
f91d894f9b (input_get_text): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:26:37 +03:00
Andrew Borodin
f4a3112d5e (input_is_empty): refactoring.
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
0222169206 (mc_search_prepare): cache result.
mc_search_struct: add new member prepared.result to keep the result of
the mc_search_prepare() first call. It can be used to check a regexp
before call of mc_search_run() in a loop.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:42:43 +03:00
Andrew Borodin
975bf17d3b mc_search_struct: rename member: conditions -> prepared_conditions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:42:43 +03:00
Andrew Borodin
c83f989a11 Fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +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
09de50d3a1 (_str_convert): fix memory leak.
Found by Coverity.
Coverity id #348334.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
9f53bf5617 Include <stddef.h> where ptrdiff_t is used.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andreas Mohr
9489b5edc4 Remove unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
98932f51f4 lib/filehighlight/get-color.c: remove extra parenthesis.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
c70658ee55 Ticket #4270: code clean up before 4.8.28 release.
lib/filehighlight/get-color.c: constify function arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
13df437ba1 Ticket #4323: fix segfault on change panel mode.
How to reproduce:
1. Set left panel to list mode.
2. Make left panel active.
3. Change left panel to info mode.
Result: segmentation fault.

(widget_replace): fix search of the next focusable widget.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-12-24 16:36:38 +03:00
Andrew Borodin
a73886ef90 mc.lib: move xterm alt-shift-arrow definitions to lib/tty/key.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
9149a6d132 (delete_region, copy_region): rename arguments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
8010b08584 (complete_engine, insert_text): don't calculate text length twice.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
e71972003e lib/strutil/strutilutf8.c: use MB_LEN_MAX constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
ccbac47385 Remove get_process_stats() test.
The GLib API is used for measurement of time intervals.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
4e8b00f003 Use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
31008bcc8e (learn_key): return NULL if buffer is empty.
(learn_button): simplify tests: seq is never empty here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
0e09fc3088 (learn_key): use g_get_real_time () to simplify time comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
254a311cc0 (get_key_code): use g_get_real_time () to simplify time comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
8885987f1d (xmouse_get_event): use g_get_real_time () to simplify time comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
40675220c1 lib/tty/key.c: use named constants for time intervals.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
c32c4b316b lib/util.c: remove unneeded include.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
93a4ecc11e lib/keybind.h: remove unneeded includes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +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
e7bbf72544 Ticket #4200: fix FTBFS with ncurses build with --disable-widec.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-28 11:46:53 +03:00
Andrew Borodin
cbc214da82 lib/tty/tty.c: fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-02 09:41:42 +03:00
filip-hejsek
bc8020e942 (tty_check_term): support tmux.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-04 18:50:46 +03:00
filip-hejsek
a2377be2ee Ticket #4233: enables mouse support in screen/tmux.
(tty_check_term): don't check $DISPLAY in screen to enable mouse support there.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-04 18:50:46 +03:00
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