From 9f6cba5c0370aee2f9803abbc35ab7e67f57ee84 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 1 Nov 2016 06:58:18 +0100 Subject: globbing supports character classes now and ^EN string building construct to escape glob patterns * globbing is fnmatch(3) compatible, now on every supported platform. * which means that escaping of glob patterns is possible now. ^ENq has been introduced to ease this task. * This finally allows you to pass unmodified filenames to EB. Previously it was impossible to open file names containing glob wildcards. * this was achieved by moving from GPattern to GRegex as the underlying implementation. * The glob pattern is converted to a regular expression before being compiled to a GRegex. This turned out to be trickier than anticipated (~140 lines of code) and has a runtime penalty of course (complexity is O(2*n) over the pattern length). It is IMHO still better than the alternatives, like importing external code from libiberty, which is potentially non-cross-platform. * Using GRegex also opens the potential of supporting brace "expansions" later in the form of glob pattern constructs (they won't actually expand but match alternatives). * is_glob_pattern() has been simplified and moved to Globber::is_pattern(). It makes sense to reuse the Globber class namespace instead of using plain functions for functions working on glob patterns. * The documentation has a new subsection on glob patterns now. * Testsuite extended with glob pattern test cases --- src/ring.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ring.cpp') diff --git a/src/ring.cpp b/src/ring.cpp index 702807d..077c58d 100644 --- a/src/ring.cpp +++ b/src/ring.cpp @@ -320,7 +320,10 @@ StateEditFile::do_edit(tecoInt id) * may also be a glob pattern, in which case * all regular files matching the pattern are opened/edited. * Globbing is performed exactly the same as the - * EN command does. + * \fBEN\fP command does. + * Also refer to the section called + * .B Glob Patterns + * for more details. * * File names of buffers in the ring are normalized * by making them absolute. @@ -379,7 +382,7 @@ StateEditFile::got_file(const gchar *filename) return &States::start; } - if (is_glob_pattern(filename)) { + if (Globber::is_pattern(filename)) { Globber globber(filename, G_FILE_TEST_IS_REGULAR); gchar *globbed_filename; -- cgit v1.2.3