diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-22 22:19:46 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-22 22:19:46 +0100 |
commit | 3e7ebb5d7b1e477df943cd01f469cf5d20f1509d (patch) | |
tree | 49693e93e1a1621aef29bb9d3de9bead3e21aa48 /src/qregisters.cpp | |
parent | a6c13d77f2f5f504c7b99e66db5f7d52c1368b8a (diff) | |
download | sciteco-3e7ebb5d7b1e477df943cd01f469cf5d20f1509d.tar.gz |
added variant of the ^U command with string building: the EU command
it became apparent, that something like this is very useful,
when constructing the contents of a q-register without
editing it.
I have decided against introducing another modifier for toggling
string building. Most commands have string building enabled and it
doesn't hurt. For the few exceptions, an alternative variant can
be introduced.
Diffstat (limited to 'src/qregisters.cpp')
-rw-r--r-- | src/qregisters.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/qregisters.cpp b/src/qregisters.cpp index 846a5a4..d59686b 100644 --- a/src/qregisters.cpp +++ b/src/qregisters.cpp @@ -46,7 +46,9 @@ namespace States { StateEQCommand eqcommand; StateLoadQReg loadqreg; StateCtlUCommand ctlucommand; - StateSetQRegString setqregstring; + StateEUCommand eucommand; + StateSetQRegString setqregstring_nobuilding(false); + StateSetQRegString setqregstring_building(true); StateGetQRegString getqregstring; StateGetQRegInteger getqreginteger; StateSetQRegInteger setqreginteger; @@ -610,7 +612,7 @@ StateLoadQReg::done(const gchar *str) } /*$ - * [c1,c2,...]^Uq[string]$ -- Set or append to Q-Register string + * [c1,c2,...]^Uq[string]$ -- Set or append to Q-Register string without string building * [c1,c2,...]:^Uq[string]$ * * If not colon-modified, it first fills the Q-Register <q> @@ -627,14 +629,38 @@ StateLoadQReg::done(const gchar *str) * * If <q> is undefined, it will be defined. * - * String-building is by default \fBdisabled\fP for ^U commands. + * String-building characters are \fBdisabled\fP for ^U + * commands. + * Therefore they are especially well-suited for defining + * \*(ST macros, since string building characters in the + * desired Q-Register contents do not have to be escaped. + * The \fBEU\fP command may be used where string building + * is desired. */ State * StateCtlUCommand::got_register(QRegister ®) { - BEGIN_EXEC(&States::setqregstring); + BEGIN_EXEC(&States::setqregstring_nobuilding); register_argument = ® - return &States::setqregstring; + return &States::setqregstring_nobuilding; +} + +/*$ + * [c1,c2,...]EUq[string]$ -- Set or append to Q-Register string with string building characters + * [c1,c2,...]:EUq[string]$ + * + * This command sets or appends to the contents of + * Q-Register \fIq\fP. + * It is identical to the \fB^U\fP command, except + * that this form of the command has string building + * characters \fBenabled\fP. + */ +State * +StateEUCommand::got_register(QRegister ®) +{ + BEGIN_EXEC(&States::setqregstring_building); + register_argument = ® + return &States::setqregstring_building; } void |