diff options
| author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-02 15:38:00 +0200 |
|---|---|---|
| committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-02 15:38:00 +0200 |
| commit | 02d414b3ab447e637fef776e387aa5a07293738a (patch) | |
| tree | 60d5db01e9e0cc15f1f8e84abb14138cb0ca54a3 /src/qregisters.h | |
| parent | 6c62ccc436d972a872616c187d460ed61c8bc0d2 (diff) | |
added <FG> command and special Q-Register "$" to set and get the current working directory
* FG stands for "Folder Go"
* FG behaves similar to a Unix shell `cd`.
Without arguments, it changes to the $HOME directory.
* The $HOME directory was previously only used by $SCITECOCONFIG on Unix.
Now it is documented on its own, since the HOME directory should also
be configurable on Windows - e.g. to adapt SciTECO to a MinGW or Cygwin
installation.
HOME is initialized just like the other environment variables.
This also means that now, the $HOME Q-Register is always defined
and can be used by platform-agnostic macros.
* FG uses a new kind of tab-completion: for directories only.
It would be annoying to complete the FG command after every
directory, so this tab-completion does not close the command
automatically. Theoretically, it would be possible to close
the command after completing a directory with no subdirectories,
but this is not supported currently.
* Filename arguments are no longer completed with " " if {} escaping
is in place as this brings no benefit. Instead no completion character
is inserted for this escape mode.
* "$" was mapped to the current directory to support an elegant way to
insert/get the current directory.
Also this allows the idiom "[$ FG...new_dir...$ ]$" for changing
the current directory temporarily.
* The Q-Register stack was extended to support restoring the string
part of special Q-Registers (that overwrite the default functionality)
when using the "[$" and "]$" commands.
* fixed minor typos (american spelling)
Diffstat (limited to 'src/qregisters.h')
| -rw-r--r-- | src/qregisters.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/qregisters.h b/src/qregisters.h index b2d856d..1ef0564 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -119,10 +119,16 @@ public: virtual gsize get_string_size(void); virtual gint get_character(gint position); + virtual void + exchange_string(QRegisterData ®) + { + string.exchange(reg.string); + } + virtual void undo_exchange_string(QRegisterData ®); + /* - * The QRegisterStack must currently access the - * integer and string fields directly to exchange - * data efficiently. + * The QRegisterStack must currently still access the + * string fields directly to exchange data efficiently. */ friend class QRegisterStack; }; @@ -183,6 +189,25 @@ public: void edit(void); }; +class QRegisterWorkingDir : public QRegister { +public: + QRegisterWorkingDir() : QRegister("$") {} + + void set_string(const gchar *str, gsize len); + void undo_set_string(void); + void append_string(const gchar *str, gsize len) {} + void undo_append_string(void) {} + + gchar *get_string(void); + gsize get_string_size(void); + gint get_character(gint pos); + + void edit(void); + + void exchange_string(QRegisterData ®); + void undo_exchange_string(QRegisterData ®); +}; + class QRegisterTable : private RBTree { class UndoTokenRemove : public UndoTokenWithSize<UndoTokenRemove> { QRegisterTable *table; |
