diff options
Diffstat (limited to 'src/FbTk/MacroCommand.cc')
-rw-r--r-- | src/FbTk/MacroCommand.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/FbTk/MacroCommand.cc b/src/FbTk/MacroCommand.cc index 511683b..0b7a6b8 100644 --- a/src/FbTk/MacroCommand.cc +++ b/src/FbTk/MacroCommand.cc | |||
@@ -33,16 +33,18 @@ namespace { | |||
33 | template <typename M> | 33 | template <typename M> |
34 | M *addCommands(M *macro, const std::string &args, bool trusted) { | 34 | M *addCommands(M *macro, const std::string &args, bool trusted) { |
35 | 35 | ||
36 | std::string blah; | 36 | std::string remainder; |
37 | std::list<std::string> cmds; | 37 | std::list<std::string> cmds; |
38 | StringUtil::stringTokensBetween(cmds, args, blah, '{', '}'); | 38 | StringUtil::stringTokensBetween(cmds, args, remainder, '{', '}'); |
39 | RefCount<Command<void> > cmd(0); | 39 | RefCount<Command<void> > cmd(0); |
40 | 40 | ||
41 | std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); | 41 | if (remainder.length() == 0) { |
42 | for (; it != it_end; ++it) { | 42 | std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); |
43 | cmd = CommandParser<void>::instance().parse(*it, trusted); | 43 | for (; it != it_end; ++it) { |
44 | if (*cmd) | 44 | cmd = CommandParser<void>::instance().parse(*it, trusted); |
45 | macro->add(cmd); | 45 | if (*cmd) |
46 | macro->add(cmd); | ||
47 | } | ||
46 | } | 48 | } |
47 | 49 | ||
48 | if (macro->size() > 0) | 50 | if (macro->size() > 0) |
@@ -64,7 +66,7 @@ Command<void> *parseMacroCmd(const std::string &command, const std::string &args | |||
64 | REGISTER_COMMAND_PARSER(macrocmd, parseMacroCmd, void); | 66 | REGISTER_COMMAND_PARSER(macrocmd, parseMacroCmd, void); |
65 | REGISTER_COMMAND_PARSER(togglecmd, parseMacroCmd, void); | 67 | REGISTER_COMMAND_PARSER(togglecmd, parseMacroCmd, void); |
66 | 68 | ||
67 | }; // end anonymous namespace | 69 | } // end anonymous namespace |
68 | 70 | ||
69 | void MacroCommand::add(RefCount<Command<void> > &com) { | 71 | void MacroCommand::add(RefCount<Command<void> > &com) { |
70 | m_commandlist.push_back(com); | 72 | m_commandlist.push_back(com); |