From 90baf34034af9363ee4cfa1654a8cc72dfc8c62e Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 25 Mar 2017 06:47:10 +0100 Subject: 0,8ED: Automatic case-folding of commands * when enabled, it will automatically upper-case all one or two letter commands (which are case insensitive). * also affects the up-carret control commands, so they when inserted they look more like real control commands. * specifically does not affect case-insensitive Q-Register specifications * the result are command lines that are better readable and conform to the coding style used in SciTECO's standard library. This eases reusing command lines as well. * Consequently, string-building and pattern match characters should be case-folded as well, but they aren't currently since State::process_edit_cmd() does not have sufficient insight into the MicroStateMachines. Also, it could not be delegated to the MicroStateMachines. Perhaps they should be abandoned in favour of embeddedable regular state machines; or regular state machines with a stack of return states? --- src/parser.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 42c4c33..fe22560 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -672,7 +672,7 @@ StateExpectFile::done(const gchar *str) return next; } -StateStart::StateStart() : State() +StateStart::StateStart() { transitions['\0'] = this; init(" \f\r\n\v"); @@ -1648,7 +1648,7 @@ StateStart::custom(gchar chr) return this; } -StateFCommand::StateFCommand() : State() +StateFCommand::StateFCommand() { transitions['\0'] = this; transitions['K'] = &States::searchkill; @@ -1842,7 +1842,7 @@ StateChangeDir::got_file(const gchar *filename) return &States::start; } -StateCondCommand::StateCondCommand() : State() +StateCondCommand::StateCondCommand() { transitions['\0'] = this; } @@ -1948,7 +1948,7 @@ StateCondCommand::custom(gchar chr) return &States::start; } -StateControl::StateControl() : State() +StateControl::StateControl() { transitions['\0'] = this; transitions['I'] = &States::insert_indent; @@ -2183,7 +2183,7 @@ StateEscape::end_of_macro(void) expressions.discard_args(); } -StateECommand::StateECommand() : State() +StateECommand::StateECommand() { transitions['\0'] = this; transitions['%'] = &States::epctcommand; @@ -2256,6 +2256,15 @@ StateECommand::custom(gchar chr) * Without any argument ED returns the current flags. * * Currently, the following flags are used by \*(ST: + * - 8: Enable/disable automatic folding of case-insensitive + * command characters during interactive key translation. + * The case of letter keys is inverted, so one or two + * character commands will typically be inserted upper-case, + * but you can still press Shift to insert lower-case letters. + * Case-insensitive Q-Register specifications are not + * case folded. + * This is thought to improve the readability of the command + * line macro. * - 16: Enable/disable automatic translation of end of * line sequences to and from line feed. * - 32: Enable/Disable buffer editing hooks -- cgit v1.2.3