Commit Graph

1786 Commits

Author SHA1 Message Date
Steef Boerrigter
e370818c09 Ticket #400: support multi-line search.
In order to use multiline search, select "Regular expression" mode and
use "\n" in the input line:

For example, if file contains lines

aaa
bbb

search string should be "aaa\nbbb".

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

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-14 18:02:23 +03:00
Andrew Borodin
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