Commit Graph

1457 Commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Andreas Mohr <and@gmx.li>
2017-01-22 18:44:22 +03:00
Andrew Borodin
37de8e6253 (mc_search__g_regex_match_full_safe): don't use negative string length.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
1ff4005228 Use g_queue_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Mooffie
c0abaa6508 (mc_search__cond_struct_new_regex_ci_str): add documentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
8b14798cc4 setup: split integer and boolean options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
c4550374b2 Change type from int to gboolean for variables controlled by checkboxes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
5e2f4a8069 WCheck: change type of 'state' from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
76ee3b1644 WCheck: remove unused C_CHANGE.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
d7ecbd51cf (radio_callback): cosmetics.
* [MSG_HOTKEY]: remove extra block.
 * [MSG_KEY]: do not fall through.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
aa6055b6aa Ticket #3693: code cleanup before 4.8.19 release.
WRadio: remove unused 'state' field.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
aae43d362f (vfs_adjust_stat): new VFS API, currently used to calculate st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
bf40acf420 Clarify usage of st_rdev. Use it if HAVE_STRUCT_STAT_ST_RDEV is defined.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
061d60b82f Modify VFS APIs.
* vfs_s_stat: make public.
  * vfs_s_lstat: likewise.
  * vfs_s_fstat: likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
a8a8e85279 (vfs_s_default_stat): define st_blksize and st_blocks explicitly.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrey Gursky
4c418047b2 Ticket #3575: preserve timestamps with nanosecond precisions during file copy
MC truncates timestamps during file copy and drops sub-second precision.

Make use of utimensat(), introduced in Linux kernel 2.6.22 (and since
2.6.26 compatible with POSIX-1.2008).

Signed-off-by: Andrey Gursky <andrey.gursky@e-mail.ua>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-25 08:46:10 +03:00
Mooffie
12812968c0 extfs: fix documentation of allowed date formats.
We also improve the documentation of vfs_parse_filedate(), which does the
actual work.

Note that in the user-facing documentation (extfs/helpers/README) there are
two things we prefer *not* to mention about vfs_parse_filedate's ability:

* Accepting the format "MM-DD-YY hh:mm[:ss]", as this two-digit year is
  more likely to confuse readers of such dates.

* Accepting '/', instead of '-', as the separator in MM-DD-YYYY. (Considering
  that some scripts do use '/', maybe we should mention it?)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-13 13:14:43 +03:00
Mooffie
1d9cd68ac3 Ticket #3589: make hex search work for binary data.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-10 18:40:02 +03:00
Andrew Borodin
8550044635 Ticket #3731: add new MSG_CHANGED_FOCUS message.
This message is sent to widgets'owner when widget's focus state is
changed.

Find file dialog: fix initial draw of ignore directories input line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-10 18:31:03 +03:00
Sorin Sbarnea
0cf8e8f6e0 Ticker #3736: mc_tmpdir() use a buffer of only 64 characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-07 09:47:55 +03:00
Mooffie
eff4d74743 (mc_search__hex_translate_to_regex): remove explicit handling of 0x prefixes.
scanf("%x") knows to eat up this prefix[1][2], so we don't need to do this
ourselves.

[1] K&R's "The C Programming Language" documents "%x" as "hexadecimal
    integer (with or without leading 0x or 0X)"
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
f96b11cf66 (mc_search__hex_translate_to_regex): rename variables.
Now that the string isn't duplicated there's nothing "temporary" about it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b2cbddb534 (mc_search__hex_translate_to_regex): avoid string duplication.
We can read from the source string directly, as we no longer modify it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
78994224ce (mc_search__hex_translate_to_regex): clean up handling of 0x prefixes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
7be9334e45 Fix quotes handling.
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.

Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
64e6ccef7f Handle invalid characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00