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 --- TODO | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index bba9d4f..e4c7b90 100644 --- a/TODO +++ b/TODO @@ -59,20 +59,6 @@ Known Bugs: window titles on exit using XTerm. Features: - * Glob patterns: GPattern, currently used in glob.cpp is - not very powerful and does not allow character classes or - escaping of glob patterns. - Unfortunately glob(3) or fnmatch(3) are POSIX-only, so - using them is not an option and does not resolve the - escaping issue in general. - We'd either have to import fnmatch(3) via Libiberty on non-POSIX - platforms, OR convert glob patterns to regexps and use - GRegEx as the underlying matcher. - The latter has the advantage that we could also provide - brace "expansion" usually performed by POSIX shells. - * Document how to escape magic characters in glob patterns. - There should be a string building construct to escape - glob characters (e.g. ^EN) * Auto-indention could be implemented via context-sensitive immediate editing commands similar to tab-expansion. Avoids having to make LF a magic character in insertion -- cgit v1.2.3