]> git.lyx.org Git - features.git/commitdiff
fix command-sequence handling
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 May 2004 14:12:50 +0000 (14:12 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 May 2004 14:12:50 +0000 (14:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8734 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxfunc.C

index a142cabb5e3a4f31e1b0ee875c7e0ce7159c4a3d..e91d34ea25d80f4fa6660e488f147e9621723a06 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-03  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * lyxfunc.C (dispatch): 
+       (getStatus): fix handling of LFUN_SEQUENCE
+
 2004-04-29  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * debug.C (showLevel): do not forget the end-of-line marker
index 4517a7e0abebe3c7a3dd9ac12f2e5bb90c3fde10..0f8d46742403f93952d30f6b3e335f36b08c593b 100644 (file)
@@ -437,6 +437,14 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
 
+       // this one is difficult to get right. As a half-baked
+       // solution, we consider only the first action of the sequence
+       case LFUN_SEQUENCE: {
+               // argument contains ';'-terminated commands
+               string const firstcmd = token(cmd.argument, ';', 0);
+               flag = getStatus(lyxaction.lookupFunc(firstcmd));
+       }
+
        case LFUN_MENUNEW:
        case LFUN_MENUNEWTMPLT:
        case LFUN_WORDFINDFORWARD:
@@ -477,7 +485,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_REPEAT:
        case LFUN_EXPORT_CUSTOM:
        case LFUN_PRINT:
-       case LFUN_SEQUENCE:
        case LFUN_SAVEPREFERENCES:
        case LFUN_SCREEN_FONT_UPDATE:
        case LFUN_SET_COLOR:
@@ -1191,14 +1198,16 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        break;
                }
 
-               case LFUN_SEQUENCE:
+               case LFUN_SEQUENCE: {
                        // argument contains ';'-terminated commands
-                       while (!argument.empty()) {
+                       string arg = argument;
+                       while (!arg.empty()) {
                                string first;
-                               string rest = split(argument, first, ';');
-                               dispatch(lyxaction.lookupFunc(rest));
+                               arg = split(arg, first, ';');
+                               dispatch(lyxaction.lookupFunc(first));
                        }
                        break;
+               }
 
                case LFUN_SAVEPREFERENCES: {
                        Path p(user_lyxdir());