diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-11 16:01:51 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-11 16:14:27 +0200 |
commit | cc63f3b25cd449573fe9b6b7d0c88f5dd0ed2f4d (patch) | |
tree | 1be1dc8d53e133ec1e0e1610e6248dc5619b2ec5 /src/glob.h | |
parent | 2a050759ab621b87d0782cc8235907a1757b46cc (diff) | |
download | sciteco-cc63f3b25cd449573fe9b6b7d0c88f5dd0ed2f4d.tar.gz |
improved file name autocompletion
* pressing ^W in FG now deletes the entire directory component as in EB
* commands without glob patterns (eg. EW) can now autocomplete file names containing
glob patterns
* When the autocompletion contains a glob character in commands accepting
glob patterns like EB or EN, we now escape the glob pattern.
This already helps if the remaining file name can be autocompleted in one go.
Unfortunately, this is still insufficient if we can only partially complete
and the partial completion contains glob characters.
For instance, if there are 2 files: `file?.txt` and `file?.foo`,
completing after `f` will insert `ile[?].`.
The second try to press Tab will already do nothing.
To fully support these cases, we need a version of teco_file_auto_complete()
accepting glob patterns.
Perhaps we can simply append `*` to the given glob pattern.
Diffstat (limited to 'src/glob.h')
-rw-r--r-- | src/glob.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -46,6 +46,21 @@ teco_globber_is_pattern(const gchar *str) gchar *teco_globber_escape_pattern(const gchar *pattern); GRegex *teco_globber_compile_pattern(const gchar *pattern); +/* in cmdline.c */ +gboolean teco_state_expectglob_process_edit_cmd(teco_machine_main_t *ctx, teco_machine_t *parent_ctx, gunichar key, GError **error); + +/** + * @interface TECO_DEFINE_STATE_EXPECTGLOB + * @implements TECO_DEFINE_STATE_EXPECTFILE + * @ingroup states + */ +#define TECO_DEFINE_STATE_EXPECTGLOB(NAME, ...) \ + TECO_DEFINE_STATE_EXPECTFILE(NAME, \ + .process_edit_cmd_cb = (teco_state_process_edit_cmd_cb_t) \ + teco_state_expectglob_process_edit_cmd, \ + ##__VA_ARGS__ \ + ) + /* * Command states */ |