diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-22 22:58:52 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-22 22:58:52 +0100 |
commit | 14cc71e053a7eddb86264049c2fc8b133870a6e6 (patch) | |
tree | 1e499aaa034878706ee4768ccd0861f59b06be02 | |
parent | 3e7ebb5d7b1e477df943cd01f469cf5d20f1509d (diff) | |
download | sciteco-14cc71e053a7eddb86264049c2fc8b133870a6e6.tar.gz |
added EI as non-string-building variant of I
this is analoguous to EU as the string-build equivalent
of ^U.
-rw-r--r-- | src/parser.cpp | 30 | ||||
-rw-r--r-- | src/parser.h | 7 |
2 files changed, 30 insertions, 7 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index f9e6332..4b8caef 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -56,7 +56,8 @@ namespace States { StateECommand ecommand; StateScintilla_symbols scintilla_symbols; StateScintilla_lParam scintilla_lparam; - StateInsert insert; + StateInsert insert_building(true); + StateInsert insert_nobuilding(false); State *current = &start; } @@ -509,7 +510,7 @@ StateStart::StateStart() : State() transitions['F'] = &States::fcommand; transitions['"'] = &States::condcommand; transitions['E'] = &States::ecommand; - transitions['I'] = &States::insert; + transitions['I'] = &States::insert_building; transitions['S'] = &States::search; transitions['N'] = &States::searchall; @@ -1698,12 +1699,15 @@ StateControl::custom(gchar chr) * In other words after all the chars on the stack have * been inserted into the buffer, a Tab-character is inserted * and then the optional <text> is inserted interactively. + * + * Like the I command, ^I has string building characters + * \fBenabled\fP. */ case 'I': - BEGIN_EXEC(&States::insert); + BEGIN_EXEC(&States::insert_building); expressions.eval(); expressions.push('\t'); - return &States::insert; + return &States::insert_building; /* * Alternatives: ^[, <CTRL/[>, <ESC> @@ -1801,6 +1805,7 @@ StateECommand::StateECommand() : State() transitions['B'] = &States::editfile; transitions['C'] = &States::executecommand; transitions['G'] = &States::egcommand; + transitions['I'] = &States::insert_nobuilding; transitions['M'] = &States::macro_file; transitions['N'] = &States::glob; transitions['S'] = &States::scintilla_symbols; @@ -2124,7 +2129,7 @@ StateScintilla_lParam::done(const gchar *str) * syntactically */ /*$ - * [c1,c2,...]I[text]$ -- Insert text + * [c1,c2,...]I[text]$ -- Insert text with string building characters * * First inserts characters for all the values * on the argument stack (interpreted as codepoints). @@ -2133,8 +2138,21 @@ StateScintilla_lParam::done(const gchar *str) * Secondly, the command inserts <text>. * In interactive mode, <text> is inserted interactively. * - * String building characters are by default enabled for the + * String building characters are \fBenabled\fP for the * I command. + * When editing \*(ST macros, using the \fBEI\fP command + * may be better, since it has string building characters + * disabled. + */ +/*$ + * [c1,c2,...]EI[text]$ -- Insert text without string building characters + * + * Inserts text at the current position in the current + * document. + * This command is identical to the \fBI\fP command, + * except that string building characters are \fBdisabled\fP. + * Therefore it may be beneficial when editing \*(ST + * macros. */ void StateInsert::initial(void) diff --git a/src/parser.h b/src/parser.h index 0c94ba0..976b215 100644 --- a/src/parser.h +++ b/src/parser.h @@ -233,6 +233,10 @@ private: * also serves as base class for replace-insertion states */ class StateInsert : public StateExpectString { +public: + StateInsert(bool building = true) + : StateExpectString(building) {} + protected: void initial(void); void process(const gchar *str, gint new_chars); @@ -248,7 +252,8 @@ namespace States { extern StateECommand ecommand; extern StateScintilla_symbols scintilla_symbols; extern StateScintilla_lParam scintilla_lparam; - extern StateInsert insert; + extern StateInsert insert_building; + extern StateInsert insert_nobuilding; extern State *current; |