Commit Graph

1885 Commits

Author SHA1 Message Date
Andrew Borodin
79645187c6 (input_get_ctext): mew API.
Use it instead of direct access to WInput's buffer.

(handle_cmdline_enter): additional minor refactoring.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:17:29 +03:00
Andrew Borodin
28154dc520 (input_destroy): remove check if WInput object is NULL. This object must exist.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:11:50 +03:00
Andrew Borodin
589155f6bf WInput: make one-line APIs inline.
* (input_get_text): make inline.
  * (input_is_empty): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:11:33 +03:00
Andrew Borodin
4e245291b4 (input_is_empty): remove checks. WInput object must exist.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:09:49 +03:00
Andrew Borodin
318315399b Ticket #4397: sort in editor without arguments stopped working.
* (input_get_text): never return NULL. If buffer is empty, return an
empty allocated string.
  * (input_push_history): use new input_get_text.
  * (find_parameters): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:09:42 +03:00
Whisperity
6cd17f6bbf Ticket #4396: (tty_check_term): support Contour terminal.
Contour terminal: https://github.com/contour-terminal/contour.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-31 19:50:27 +03:00
Andrew Borodin
6c45208744 Fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 20:12:46 +03:00
Andrew Borodin
f5399c6d4d lib/util.h: fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
101714e39b (query_default_callback): clarify widget position.
If dialog should be placed too high (in the upper half of the screen
closer to the screen top), show it centered.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
4008d3b96c (mc_config_get_string): use mc_config_get_string_raw()
...to get rid of code duplcation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
ebb328353e (vfs_s_subclass::dir_load): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:44 +03:00
Andrew Borodin
db8bc2fbff Minor refactoring of path canonicalization.
(canon_path_flags_t): rename from CANON_PATH_FLAGS, add
CANON_PATH_NOCHANGE value, clarify comments.
(canonicalize_pathname_custom): rename from custom_canonicalize_pathname,
update description.
(canonicalize_pathname): add description.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:17:59 +03:00
Andrew Borodin
4ceb5c5105 (mc_chdir): clarufy setup of errno. 2022-06-05 12:00:26 +03:00
Andrew Borodin
bae8fe0af0 (vfs_path_get_by_index): set errno, update description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:00:25 +03:00
Andrew Borodin
666586e41a Fix ENOTSUP usage.
Remove E_NOTSUPP define. Use ENOTSUP directly where required.

(vfs_clone_file): use ENOTSUP instead of EOPNOTSUPP.
(mc_open): likewize. Fix sign.

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

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

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

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:03 +03:00
Andrew Borodin
aac258e44e (rect_grow): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:50:19 +03:00
Andrew Borodin
5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin
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