changeset 16678:518dbe0ae857

fix auto completion for octave files in editor * file-editor-tab.cc(update_lexer): get keyword list from lexer for auto completion
author Torsten <ttl@justmail.de>
date Sat, 18 May 2013 15:17:03 +0200
parents f6dfc7705623
children cf939872811c
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat May 18 15:06:33 2013 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sat May 18 15:17:03 2013 +0200
@@ -259,8 +259,26 @@
         }
     }
 
+  if (lexer)
+    {
+      QsciAPIs *apis = new QsciAPIs(lexer);
+      if (apis)
+        {
+          QString keyword;
+          QStringList keyword_list;
+          int i;
+          for (i=1; i<=3; i++) // load the first 3 keyword sets
+            {
+              keyword = QString(lexer->keywords (i));           // get list
+              keyword_list = keyword.split (QRegExp ("\\s+"));  // split
+              for (i = 0; i < keyword_list.size (); i++)        // add to API
+                apis->add (keyword_list.at (i));
+            }
+          apis->prepare ();
+        }
+    }
+
   QSettings *settings = resource_manager::get_settings ();
-
   if (settings)
     lexer->readSettings (*settings);