[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: [Bug 135844] New: [PATCH] Enhance highlighting IncludeRules to allow
From: Matthew Woehlke <mwoehlke () tibco ! com>
Date: 2006-10-17 21:17:37
Message-ID: 20061017231736.135844.mwoehlke () tibco ! com
[Download RAW message or body]
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=135844
Summary: [PATCH] Enhance highlighting IncludeRules to allow
'foo##bar'-style inclusions
Product: kate
Version: unspecified
Platform: Compiled Sources
OS/Version: Linux
Status: UNCONFIRMED
Severity: wishlist
Priority: NOR
Component: general
AssignedTo: kwrite-devel kde org
ReportedBy: mwoehlke tibco com
Version: (using KDE KDE 3.5.5)
Installed from: Compiled From Sources
OS: Linux
The following (trivial!) patch adds support for including contexts other than the \
root from external highlighters (via 'IncludeRules context##highlighter'). Oddly \
enough, context resolution already handles this case if \
KateHighlighting::addToContextList recognizes it correctly.
===
diff -ur orig/kdelibs-3.5.5/kate/part/katehighlight.cpp \
kdelibs-3.5.5/kate/part/katehighlight.cpp
--- orig/kdelibs-3.5.5/kate/part/katehighlight.cpp 2006-07-22 03:16:36.000000000 \
-0500
+++ kdelibs-3.5.5/kate/part/katehighlight.cpp 2006-10-17 15:19:05.573601049 -0500
@ -2745,31 +2745,34 @
QString incCtx = KateHlManager::self()->syntax->groupItemData( data, \
QString("context"));
QString incAttrib = KateHlManager::self()->syntax->groupItemData( data, \
QString("includeAttrib")); bool includeAttrib = IS_TRUE( incAttrib );
- // only context refernces of type NAME and ##Name are allowed
+ // only context refernces of type Name, ##Name, and Subname##Name are \
allowed if (incCtx.startsWith("##") || (!incCtx.startsWith("#")))
{
+ int incCtxi = incCtx.find("##");
//#stay, #pop is not interesting here
- if (!incCtx.startsWith("#"))
- {
- // a local reference -> just initialize the include rule structure
- incCtx=buildPrefix+incCtx.simplifyWhiteSpace();
- includeRules.append(new \
KateHlIncludeRule(i,m_contexts[i]->items.count(),incCtx, \
includeAttrib));
- }
- else
+ if (incCtxi >= 0)
{
+ QString incSet = incCtx.mid(incCtxi + 2);
+
//a cross highlighting reference
- kdDebug(13010)<<"Cross highlight reference <IncludeRules>"<<endl;
+ kdDebug(13010)<<"Cross highlight reference <IncludeRules \"" << incCtx \
<< "\">"<<endl; + kdDebug(13010)<<"Included rule set is \"" << incSet << \
"\""<<endl;
KateHlIncludeRule *ir=new \
KateHlIncludeRule(i,m_contexts[i]->items.count(),"",includeAttrib);
//use the same way to determine cross hl file references as other items \
do
- if (!embeddedHls.contains(incCtx.right(incCtx.length()-2)))
- embeddedHls.insert(incCtx.right(incCtx.length()-2),KateEmbeddedHlInfo());
+ if (!embeddedHls.contains(incSet))
+ embeddedHls.insert(incSet,KateEmbeddedHlInfo());
- unresolvedContextReferences.insert(&(ir->incCtx),
- incCtx.right(incCtx.length()-2));
+ unresolvedContextReferences.insert(&(ir->incCtx), incSet);
includeRules.append(ir);
}
+ else
+ {
+ // a local reference -> just initialize the include rule structure
+ incCtx=buildPrefix+incCtx.simplifyWhiteSpace();
+ includeRules.append(new \
KateHlIncludeRule(i,m_contexts[i]->items.count(),incCtx, includeAttrib)); + \
} }
continue;
===
This resolves one cause of bug #135783.
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic