diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-12 15:12:59 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-12 15:12:59 +0200 |
commit | 7919aca84cdea7746b60fec9795e9617c266dd1d (patch) | |
tree | 90db8c7d899b69014d085af0cf3327741691df6a /src/ring.cpp | |
parent | 3551924ccd580a59190ac80e25c59b729ec4f613 (diff) | |
download | sciteco-7919aca84cdea7746b60fec9795e9617c266dd1d.tar.gz |
support UNIX-shell-like tilde-expansions in file names and directories
* expands to the value of $HOME (the env variable instead of
the register which currently makes a slight difference).
* supported for tab-completions
* supported for all file-name accepting commands.
The expansion is done centrally in StateExpectFile::done().
A new virtual method StateExpectFile::got_file() has been
introduced to pass the expanded/processed file name to
command implementations.
* sciteco(7) has been updated: There is now a separate section
on file name arguments and file name handling in SciTECO.
This information is important but has been scattered across
the document previously.
* optimized is_glob_pattern() in glob.h
Diffstat (limited to 'src/ring.cpp')
-rw-r--r-- | src/ring.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ring.cpp b/src/ring.cpp index 906e72a..4646ea1 100644 --- a/src/ring.cpp +++ b/src/ring.cpp @@ -355,26 +355,26 @@ StateEditFile::initial(void) } State * -StateEditFile::done(const gchar *str) +StateEditFile::got_file(const gchar *filename) { BEGIN_EXEC(&States::start); if (!allowFilename) { - if (*str) + if (*filename) throw Error("If a buffer is selected by id, the <EB> " "string argument must be empty"); return &States::start; } - if (is_glob_pattern(str)) { - Globber globber(str, G_FILE_TEST_IS_REGULAR); - gchar *filename; + if (is_glob_pattern(filename)) { + Globber globber(filename, G_FILE_TEST_IS_REGULAR); + gchar *globbed_filename; - while ((filename = globber.next())) - do_edit(filename); + while ((globbed_filename = globber.next())) + do_edit(globbed_filename); } else { - do_edit(*str ? str : NULL); + do_edit(*filename ? filename : NULL); } return &States::start; @@ -422,14 +422,14 @@ StateEditFile::done(const gchar *str) * characters are enabled by default. */ State * -StateSaveFile::done(const gchar *str) +StateSaveFile::got_file(const gchar *filename) { BEGIN_EXEC(&States::start); if (QRegisters::current) - QRegisters::current->save(str); + QRegisters::current->save(filename); else - ring.current->save(*str ? str : NULL); + ring.current->save(*filename ? filename : NULL); return &States::start; } |