------=_Part_1732_10903434.1107835805973 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline I've taken the liberty of implementing the suggested new blankLineContext attribute for contexts. My patch is attached. It seems to work fine, but I've never looked at the Kate code (well, or used Kate, for that matter) before so I may well have missed something. While I was there I also changed the lineBeginContext attribute handling to work with symbolic contexts as well as numeric. This attribute doesn't look to actually do anything though?? ------=_Part_1732_10903434.1107835805973 Content-Type: text/x-patch; name="blankLine.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="blankLine.patch" Index: data/language.dtd =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/kate/data/language.dtd,v retrieving revision 1.37 diff -u -3 -p -r1.37 language.dtd --- data/language.dtd=0921 Nov 2004 23:05:32 -0000=091.37 +++ data/language.dtd=098 Feb 2005 03:44:44 -0000 @@ -162,6 +162,7 @@ TODO attribute: The name of the ItemData to be used for matching text lineEndContext: Next context if end of line is encountered lineBeginContext: Next context if begin of line is encountered [optional= ] + blankLineContext: Next context if the line is totally empty [optional] fallthrough: Use a fallthrough context [optional] fallthroughContext: Fall through to this context [optional] dynamic: Dynamic context [boolean, optional] @@ -177,6 +178,7 @@ TODO: attribute CDATA #REQUIRED lineEndContext CDATA #REQUIRED lineBeginContext CDATA #IMPLIED + blankLineContext CDATA #IMPLIED fallthrough (%boolean;) #IMPLIED fallthroughContext CDATA #IMPLIED dynamic (%boolean;) #IMPLIED Index: part/katehighlight.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/kate/part/katehighlight.cpp,v retrieving revision 1.214 diff -u -3 -p -r1.214 katehighlight.cpp --- part/katehighlight.cpp=0924 Jan 2005 13:27:03 -0000=091.214 +++ part/katehighlight.cpp=098 Feb 2005 03:44:45 -0000 @@ -115,7 +115,7 @@ class KateHlContext { public: KateHlContext(const QString &_hlId, int attribute, int lineEndContext,= int _lineBeginContext, - bool _fallthrough, int _fallthroughContext, bool _dynami= c); + int _blankLineContext, bool _fallthrough, int _fallthrou= ghContext, bool _dynamic); virtual ~KateHlContext(); KateHlContext *clone(const QStringList *args); =20 @@ -124,6 +124,7 @@ class KateHlContext int attr; int ctx; int lineBeginContext; + int blankLineContext; /** @internal anders: possible escape if no rules matches. false unless 'fallthrough=3D"1|true"' (insensitive) if true, go to ftcxt w/o eating of string. @@ -1126,12 +1127,14 @@ KateHlData::KateHlData(const QString &wi } =20 //BEGIN KateHlContext -KateHlContext::KateHlContext (const QString &_hlId, int attribute, int lin= eEndContext, int _lineBeginContext, bool _fallthrough, int _fallthroughCont= ext, bool _dynamic) +KateHlContext::KateHlContext (const QString &_hlId, int attribute, int lin= eEndContext, int _lineBeginContext, +=09=09=09 int _blankLineContext, bool _fallthrough, int _fallthroughC= ontext, bool _dynamic) { hlId =3D _hlId; attr =3D attribute; ctx =3D lineEndContext; lineBeginContext =3D _lineBeginContext; + blankLineContext =3D _blankLineContext; fallthrough =3D _fallthrough; ftctx =3D _fallthroughContext; dynamic =3D _dynamic; @@ -1140,7 +1143,7 @@ KateHlContext::KateHlContext (const QStr =20 KateHlContext *KateHlContext::clone(const QStringList *args) { - KateHlContext *ret =3D new KateHlContext(hlId, attr, ctx, lineBeginConte= xt, fallthrough, ftctx, false); + KateHlContext *ret =3D new KateHlContext(hlId, attr, ctx, lineBeginConte= xt, blankLineContext, fallthrough, ftctx, false); =20 for (uint n=3D0; n < items.size(); ++n) { @@ -1395,6 +1398,13 @@ void KateHighlighting::doHighlight ( Kat const QString& text =3D textLine->string(); const int len =3D textLine->length(); =20 + if (len =3D=3D 0 && context->blankLineContext !=3D -1) + { + // regenerate context stack if needed + generateContextStack (&ctxNum, context->blankLineContext, &ctx, &pre= viousLine); + context =3D contextNum(ctxNum); + } + // calc at which char the first char occurs, set it to lenght of line if= never const int firstChar =3D textLine->firstChar(); const int startNonSpace =3D (firstChar =3D=3D -1) ? len : firstChar; @@ -2682,8 +2692,8 @@ int KateHighlighting::addToContextList(c ident, attr, context, - (KateHlManager::self()->syntax->groupData(data,QString("lineBeginC= ontext"))).isEmpty()?-1: - (KateHlManager::self()->syntax->groupData(data,QString("lineBeginC= ontext"))).toInt(), +=09getIdFromString(&ContextNameList, KateHlManager::self()->syntax->groupD= ata(data,QString("lineBeginContext")), dummy), +=09getIdFromString(&ContextNameList, KateHlManager::self()->syntax->groupD= ata(data,QString("blankLineContext")), dummy), ft, ftc, dynamic); =20 m_contexts.push_back (ctxNew); ------=_Part_1732_10903434.1107835805973 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KWrite-Devel mailing list KWrite-Devel@kde.org https://mail.kde.org/mailman/listinfo/kwrite-devel ------=_Part_1732_10903434.1107835805973--