A new user interface for you! Read more...

File kdeaddons-trinity-kate-fix-recognition-of-cpp-files.patch of Package kdeaddons3

From 4d976d10e8d99776881152c0911f80890ffba579 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Fri, 07 Aug 2015 14:38:43 +0000
Subject: Fixed recognition of C++ files in kate/cppsymbolviewer plugin. This resolves bug 2498. Also fixed building warnings.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
diff --git a/kate/cppsymbolviewer/cpp_parser.cpp b/kate/cppsymbolviewer/cpp_parser.cpp
index b666983..9aceda2 100644
--- a/kate/cppsymbolviewer/cpp_parser.cpp
+++ b/kate/cppsymbolviewer/cpp_parser.cpp
@@ -23,9 +23,9 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
  QString cl; // Current Line
  QString stripped;
  uint i, j, tmpPos = 0;
- int par = 0, graph = 0, retry = 0;
+ int par = 0, graph = 0;
  char mclass = 0, block = 0, comment = 0; // comment: 0-no comment 1-inline comment 2-multiline comment 3-string
- char macro = 0, macro_pos = 0, func_close = 0;
+ char macro = 0, func_close = 0;
  bool structure = false;
  QPixmap cls( ( const char** ) class_xpm );
  QPixmap sct( ( const char** ) struct_xpm );
@@ -76,7 +76,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
        /* *********************** MACRO PARSING *****************************/
        if(macro == 1)
          {
-          //macro_pos = cl.find("#");
           for (j = 0; j < cl.length(); j++)
              {
               if(cl.at(j)=='/' && cl.at(j+1)=='/') { macro = 4; break; }
@@ -113,7 +112,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
                   node->setText(1, QString::number( i, 10));
                  }
               macro = 0;
-              macro_pos = 0;
               stripped = "";
               //kdDebug(13000)<<"Macro -- Inserted : "<<stripped<<" at row : "<<i<<endl;
               if (cl.at(cl.length() - 1) == '\\') macro = 5; // continue in rows below
@@ -158,7 +156,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
          }
        if (mclass == 3)
          {
-          if (cl.find('{') >= 0) 
+          if (cl.find('{') >= 0)
             {
              cl = cl.right(cl.find('{'));
              mclass = 4;
@@ -216,8 +214,8 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
                       break;
                      }
 
-                   if(cl.at(j)=='{' && structure == false && cl.find(";") < 0 ||
-                      cl.at(j)=='{' && structure == false && cl.find('}') > (int)j)
+                   if((cl.at(j)=='{' && structure == false && cl.find(";") < 0) ||
+                      (cl.at(j)=='{' && structure == false && cl.find('}') > (int)j))
                      {
                       stripped.replace(0x9, " ");
                       if(func_on == true)
@@ -240,7 +238,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
                                node = new QListViewItem(mtdNode, lastMtdNode, stripped);
                                lastMtdNode = node;
                               }
-                            else 
+                            else
                               {
                                node = new QListViewItem(clsNode, lastClsNode, stripped);
                                lastClsNode = node;
@@ -253,7 +251,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
                          node->setText(1, QString::number( tmpPos, 10));
                         }
                       stripped = "";
-                      retry = 0;
                       block = 3;
                      }
                    if(cl.at(j)=='{' && structure == true)
@@ -263,7 +260,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
                      }
                    if(cl.at(j)=='(' && structure == true)
                      {
-                      retry = 1;
                       block = 0;
                       j = 0;
                       //kdDebug(13000)<<"Restart from the beginning of line..."<<endl;
@@ -319,7 +315,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
          } // BLOCK > 0
        if (mclass == 4 && block == 0 && func_close == 0)
          {
-          if (cl.find('}') >= 0) 
+          if (cl.find('}') >= 0)
             {
              cl = cl.right(cl.find('}'));
              mclass = 0;
diff --git a/kate/cppsymbolviewer/plugin_katesymbolviewer.cpp b/kate/cppsymbolviewer/plugin_katesymbolviewer.cpp
index 3bc152a..3de7fa2 100644
--- a/kate/cppsymbolviewer/plugin_katesymbolviewer.cpp
+++ b/kate/cppsymbolviewer/plugin_katesymbolviewer.cpp
@@ -219,7 +219,7 @@ void KatePluginSymbolViewerView::parseSymbols(void)
 
   //QListViewItem mcrNode = new QListViewItem(symbols, symbols->lastItem(), hlModeName);
 
-  if (hlModeName == "C++" || hlModeName == "C")
+  if (hlModeName == "C" || hlModeName == "ISO C++" || hlModeName.find("C++")==0)
      parseCppSymbols();
   else if (hlModeName == "Tcl/Tk")
      parseTclSymbols();
--
cgit v0.9.0.2-52-g1de3