summaryrefslogtreecommitdiff
path: root/app-office/texstudio/files/texstudio-4.9.5-fix_structure_lookup.patch
blob: f87d6a403833392f2e03254d7e20bcccc9942d19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
https://github.com/texstudio-org/texstudio/commit/e0fcba2.patch
backport fix for cache regression from 4.9.4
see https://github.com/texstudio-org/texstudio/issues/4505
--- a/src/latexparser/latexparser.cpp
+++ b/src/latexparser/latexparser.cpp
@@ -196,8 +196,12 @@ QString removeOptionBrackets(const QString &option)
  * \param cmd latex command
  * \return level of stucture
  */
-int LatexParser::structureCommandLevel(const QString &cmd) const
+int LatexParser::structureCommandLevel(const QString &cmd)
 {
+    if(sectionCommands.isEmpty()){
+        // not yet chached, do it now
+        cacheStructureCommand();
+    }
     if(!sectionCommands.contains(cmd)) return -1;
 	for (int i=0; i<=MAX_STRUCTURE_LEVEL; i++) {
 		if (possibleCommands[QString("%structure%1").arg(i)].contains(cmd)) {
--- a/src/latexparser/latexparser.h
+++ b/src/latexparser/latexparser.h
@@ -33,7 +33,7 @@ class LatexParser
 	{
 		return MAX_STRUCTURE_LEVEL;
 	}
-    int structureCommandLevel(const QString &cmd) const;
+    int structureCommandLevel(const QString &cmd);
     void cacheStructureCommand();
 
 	QSet<QString> environmentCommands; ///< used by LatexReader only, obsolete