diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-13 09:46:41 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-13 09:46:41 +0100 |
commit | 3c395e56140c991ea776fedde0eaba230060c767 (patch) | |
tree | 82b629ddbfc6127b9f9e5f2b8745b5c35d4dc701 /qbuffers.h | |
parent | 5db6dee299389eb3b939ca5d6ebfcefceb40c4c5 (diff) | |
download | sciteco-3c395e56140c991ea776fedde0eaba230060c767.tar.gz |
added EW...$ command
* EW$ saves file with its current filename
* EW<filename>$ saves file with under the specified filename (Save As)
* files are stored with absolute paths in the ring
Diffstat (limited to 'qbuffers.h')
-rw-r--r-- | qbuffers.h | 38 |
1 files changed, 26 insertions, 12 deletions
@@ -14,6 +14,20 @@ #include "rbtree.h" #include "parser.h" +/* + * Auxiliary functions + */ +static inline bool +is_glob_pattern(const gchar *str) +{ + return strchr(str, '*') || strchr(str, '?'); +} + +gchar *get_absolute_path(const gchar *path); + +/* + * Classes + */ class QRegister : public RBTree::RBEntry { public: gchar *name; @@ -164,7 +178,7 @@ public: set_filename(const gchar *filename) { g_free(Buffer::filename); - Buffer::filename = filename ? g_strdup(filename) : NULL; + Buffer::filename = get_absolute_path(filename); } inline void @@ -220,6 +234,8 @@ public: current->undo_edit(); } + bool save(const gchar *filename); + void close(void); inline void undo_close(void) @@ -232,7 +248,7 @@ public: * Command states */ -class StateFile : public StateExpectString { +class StateEditFile : public StateExpectString { private: void do_edit(const gchar *filename); @@ -240,6 +256,11 @@ private: State *done(const gchar *str); }; +class StateSaveFile : public StateExpectString { +private: + State *done(const gchar *str); +}; + class StateEQCommand : public StateExpectQReg { private: State *got_register(QRegister *reg); @@ -286,7 +307,9 @@ private: }; namespace States { - extern StateFile file; + extern StateEditFile editfile; + extern StateSaveFile savefile; + extern StateEQCommand eqcommand; extern StateLoadQReg loadqreg; extern StateCtlUCommand ctlucommand; @@ -298,13 +321,4 @@ namespace States { extern StateCopyToQReg copytoqreg; } -/* - * Auxiliary functions - */ -static inline bool -is_glob_pattern(const gchar *str) -{ - return strchr(str, '*') || strchr(str, '?'); -} - #endif |