Browse Source

"Switchable" only switches to other styles with the same ending.

git-svn-id: file:///var/svn/tigccpp/trunk@804 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 years ago
parent
commit
7c73c8b3aa
1 changed files with 39 additions and 37 deletions
  1. 39 37
      ktigcc/preferences.cpp

+ 39 - 37
ktigcc/preferences.cpp

@@ -306,43 +306,45 @@ static void writeSyntaxXML(const Syn_SettingsForDoc &synprefs,
            it2!=synprefs.customStyles.end(); ++it2) {
         if (it2==it) continue;
         const Syn_CustomStyle &otherCustomStyle=*it2;
-        switch (otherCustomStyle.beginning.length()) {
-          case 0: // Ignore these ones altogether.
-            break;
-          case 1:
-            {
-              CHILD_NODE(detectCustomStyle,customStyleContext,"DetectChar");
-              ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
-              ADD_ATTR(detectCustomStyle,"context","#pop");
-              if (otherCustomStyle.lineStartOnly)
-                ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
-              ADD_ATTR(detectCustomStyle,"char",otherCustomStyle.beginning.left(1));
-              ADD_ATTR(detectCustomStyle,"lookAhead","true");
-            }
-            break;
-          case 2:
-            {
-              CHILD_NODE(detectCustomStyle,customStyleContext,"Detect2Chars");
-              ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
-              ADD_ATTR(detectCustomStyle,"context","#pop");
-              if (otherCustomStyle.lineStartOnly)
-                ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
-              ADD_ATTR(detectCustomStyle,"char",otherCustomStyle.beginning.left(1));
-              ADD_ATTR(detectCustomStyle,"char1",otherCustomStyle.beginning.mid(1,1));
-              ADD_ATTR(detectCustomStyle,"lookAhead","true");
-            }
-            break;
-          default:
-            {
-              CHILD_NODE(detectCustomStyle,customStyleContext,"StringDetect");
-              ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
-              ADD_ATTR(detectCustomStyle,"context","#pop");
-              if (otherCustomStyle.lineStartOnly)
-                ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
-              ADD_ATTR(detectCustomStyle,"String",otherCustomStyle.beginning);
-              ADD_ATTR(detectCustomStyle,"lookAhead","true");
-            }
-            break;
+        if (otherCustomStyle.ending==customStyle.ending) {
+          switch (otherCustomStyle.beginning.length()) {
+            case 0: // Ignore these ones altogether.
+              break;
+            case 1:
+              {
+                CHILD_NODE(detectCustomStyle,customStyleContext,"DetectChar");
+                ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
+                ADD_ATTR(detectCustomStyle,"context","#pop");
+                if (otherCustomStyle.lineStartOnly)
+                  ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
+                ADD_ATTR(detectCustomStyle,"char",otherCustomStyle.beginning.left(1));
+                ADD_ATTR(detectCustomStyle,"lookAhead","true");
+              }
+              break;
+            case 2:
+              {
+                CHILD_NODE(detectCustomStyle,customStyleContext,"Detect2Chars");
+                ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
+                ADD_ATTR(detectCustomStyle,"context","#pop");
+                if (otherCustomStyle.lineStartOnly)
+                  ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
+                ADD_ATTR(detectCustomStyle,"char",otherCustomStyle.beginning.left(1));
+                ADD_ATTR(detectCustomStyle,"char1",otherCustomStyle.beginning.mid(1,1));
+                ADD_ATTR(detectCustomStyle,"lookAhead","true");
+              }
+              break;
+            default:
+              {
+                CHILD_NODE(detectCustomStyle,customStyleContext,"StringDetect");
+                ADD_ATTR(detectCustomStyle,"attribute",otherCustomStyle.name);
+                ADD_ATTR(detectCustomStyle,"context","#pop");
+                if (otherCustomStyle.lineStartOnly)
+                  ADD_ATTR(detectCustomStyle,"firstNonSpace","true");
+                ADD_ATTR(detectCustomStyle,"String",otherCustomStyle.beginning);
+                ADD_ATTR(detectCustomStyle,"lookAhead","true");
+              }
+              break;
+          }
         }
       }
     }