aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ioview.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-02 15:38:00 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-02 15:38:00 +0200
commit02d414b3ab447e637fef776e387aa5a07293738a (patch)
tree60d5db01e9e0cc15f1f8e84abb14138cb0ca54a3 /src/ioview.h
parent6c62ccc436d972a872616c187d460ed61c8bc0d2 (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/ioview.h')
-rw-r--r--src/ioview.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ioview.h b/src/ioview.h
index d314138..d9d8265 100644
--- a/src/ioview.h
+++ b/src/ioview.h
@@ -22,6 +22,7 @@
#include <glib.h>
#include <glib/gstdio.h>
+#include <glib/gprintf.h>
#include "sciteco.h"
#include "interface.h"
@@ -43,6 +44,28 @@ namespace SciTECO {
*/
gchar *get_absolute_path(const gchar *path);
+/**
+ * Normalize path or file name.
+ *
+ * This changes the directory separators
+ * to forward slash (on platforms that support
+ * different directory separator styles).
+ *
+ * @param path The path to normalize.
+ * It is changed in place.
+ * @return Returns `path`. The return value
+ * may be ignored.
+ */
+static inline gchar *
+normalize_path(gchar *path)
+{
+#if G_DIR_SEPARATOR != '/'
+ return g_strdelimit(path, G_DIR_SEPARATOR_S, '/');
+#else
+ return path;
+#endif
+}
+
bool file_is_visible(const gchar *path);
/**