diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-02 16:08:41 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-06-02 16:08:41 +0200 |
commit | 88dc6ac6daea0f0a16c7cf8a1e32d509121ff15c (patch) | |
tree | 7dddb9ef7c8f4efec163e432c4000704d166549a | |
parent | 02d414b3ab447e637fef776e387aa5a07293738a (diff) | |
download | sciteco-88dc6ac6daea0f0a16c7cf8a1e32d509121ff15c.tar.gz |
throw error when trying to set or append the string part of "*" and appending to "$"
* these operations are unsupported and there is no benefit
in ignoring them silently. It only confused the user.
-rw-r--r-- | doc/sciteco.7.template | 2 | ||||
-rw-r--r-- | src/error.h | 8 | ||||
-rw-r--r-- | src/qregisters.h | 21 |
3 files changed, 28 insertions, 3 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 8272b08..1e3739a 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -1017,6 +1017,7 @@ always have forward-slash directory separators even if they are displayed differently in the user interface. The \(lq*\(rq register may also be edited but changing its string contents has no effect on the file name of the buffer. +Setting and appending to the \(lq*\(rq register is unsupported. Setting the numeric part of the \(lq*\(rq register, as in \(lq1U*\(rq, is equivalent to editing a buffer by id (e.g. \(lq1EB\fB$\fP\(rq) but is shorter since there is no @@ -1048,6 +1049,7 @@ but querying \(lq$\(rq will still return an absolute path. The \(lq$\(rq register may also be edited but changing its string contents this way has no effect on the current working directory. +Appending to the \(lq$\(rq register is unsupported. .TP .BR $ " (Escape)" Command-line replacement register. diff --git a/src/error.h b/src/error.h index c9cad00..26c98f6 100644 --- a/src/error.h +++ b/src/error.h @@ -193,6 +193,14 @@ public: local ? "." : "", name) {} }; +class QRegOpUnsupportedError : public Error { +public: + QRegOpUnsupportedError(const gchar *name, bool local = false) + : Error("Operation unsupported on " + "Q-Register \"%s%s\"", + local ? "." : "", name) {} +}; + } /* namespace SciTECO */ #endif diff --git a/src/qregisters.h b/src/qregisters.h index 1ef0564..2933dc8 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -28,6 +28,7 @@ #include <Scintilla.h> #include "sciteco.h" +#include "error.h" #include "interface.h" #include "ioview.h" #include "undo.h" @@ -177,9 +178,18 @@ public: tecoInt get_integer(void); - void set_string(const gchar *str, gsize len) {} + void + set_string(const gchar *str, gsize len) + { + throw QRegOpUnsupportedError(name); + } void undo_set_string(void) {} - void append_string(const gchar *str, gsize len) {} + + void + append_string(const gchar *str, gsize len) + { + throw QRegOpUnsupportedError(name); + } void undo_append_string(void) {} gchar *get_string(void); @@ -195,7 +205,12 @@ public: void set_string(const gchar *str, gsize len); void undo_set_string(void); - void append_string(const gchar *str, gsize len) {} + + void + append_string(const gchar *str, gsize len) + { + throw QRegOpUnsupportedError(name); + } void undo_append_string(void) {} gchar *get_string(void); |