Summary: | Select S&S indentation. Type '///', followed by enter. Segfaults. | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Tim Hutt <tdhutt> |
Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED DUPLICATE | ||
Severity: | crash | CC: | esigra, l_px |
Priority: | HI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Tim Hutt
2006-08-23 02:00:47 UTC
Changed to high as you can lose work just by typing! Also, it didn't work in a blank file, because that didn't seem to do indentation even after getting tools->indentation->SS [sic - fixed in trunk I noticed!] style. Is that another bug? I'll try and fix this tomorrow. Indenter depends on highlighter. Set a highlighting mode and the indenter will work in a blank document too. *** This bug has been marked as a duplicate of 131933 *** Are you sure? I did these exact steps: a) Start kate (gives you an 'untitled' document) b) Tools->Indentation->S&S style c) Tools->Highlighting->Sources->C++ d) Type this: int main() { <enter> And it doesn't indent it. Maybe I'm missing something. Thanks for fixing the other bug! a) Start kate (gives you an 'untitled' document) b) Tools->Indentation->S&S style c) Tools->Highlighting->Sources->C++ d) Type this: int main() { <enter> result: No indentation Now, step b and c swapped: a) Start kate (gives you an 'untitled' document) b) Tools->Highlighting->Sources->C++ c) Tools->Indentation->S&S style d) Type this: int main() { <enter> result: Indentation works. Reason for the bug: KateAutoIndent::updateConfig() is called when creating an instance of the indenter, it then reads highlighting information and caches them. Highlighting is not set yet, so the cached infos are wrong. That's why it works, if we swap b and c. Fix: Call m_indenter->updateConfig() whenever the Highlighting changes. Todo: find the right place for this call ;) Maybe it would even be better, if the indenters that rely on highlighting connect themselves to the signal KateDocument::hlChanged(). Any comments of kate devs? :) proposal: 1. make KateAutoIndent::updateConfig() a public slot. 2. connect signal doc->hlChanged() to updateConfig() in KateNormalIndenter's constructor. SVN commit 577126 by dhaumann: fix the bug state in comment #3 of bug #132835. (This includes deriving KateAutoIndent from QObject.) CCBUG: 132835 M +5 -4 kateautoindent.cpp M +21 -2 kateautoindent.h --- branches/KDE/3.5/kdelibs/kate/part/kateautoindent.cpp #577125:577126 @@ -148,7 +148,7 @@ } KateAutoIndent::KateAutoIndent (KateDocument *_doc) -: doc(_doc) +: QObject(), doc(_doc) { } KateAutoIndent::~KateAutoIndent () @@ -186,7 +186,10 @@ KateNormalIndent::KateNormalIndent (KateDocument *_doc) : KateAutoIndent (_doc) { + // if highlighting changes, update attributes + connect(_doc, SIGNAL(hlChanged()), this, SLOT(updateConfig())); } + KateNormalIndent::~KateNormalIndent () { } @@ -2022,7 +2025,7 @@ }; KateVarIndent::KateVarIndent( KateDocument *doc ) -: QObject( 0, "variable indenter"), KateNormalIndent( doc ) +: KateNormalIndent( doc ) { d = new KateVarIndentPrivate; d->reIndentAfter = QRegExp( doc->variable( "var-indent-indent-after" ) ); @@ -2070,8 +2073,6 @@ void KateVarIndent::processLine ( KateDocCursor &line ) { - updateConfig(); // ### is it really nessecary *each time* ?? - QString indent; // store the indent string here // find the first line with content that is not starting with comment text, --- branches/KDE/3.5/kdelibs/kate/part/kateautoindent.h #577125:577126 @@ -67,8 +67,10 @@ * This baseclass is a real dummy, does nothing beside remembering the document it belongs too, * only to have the object around */ -class KateAutoIndent +class KateAutoIndent : public QObject { + Q_OBJECT + /** * Static methods to create and list indention modes */ @@ -133,11 +135,13 @@ */ virtual ~KateAutoIndent (); + public slots: /** * Update indenter's configuration (indention width, attributes etc.) */ virtual void updateConfig () {}; + public: /** * does this indenter support processNewLine * @return can you do it? @@ -212,6 +216,8 @@ */ class KateNormalIndent : public KateAutoIndent { + Q_OBJECT + public: /** * Constructor @@ -224,11 +230,13 @@ */ virtual ~KateNormalIndent (); +public slots: /** * Update indenter's configuration (indention width, attributes etc.) */ virtual void updateConfig (); +public: /** * does this indenter support processNewLine * @return can you do it? @@ -334,6 +342,8 @@ class KateCSmartIndent : public KateNormalIndent { + Q_OBJECT + public: KateCSmartIndent (KateDocument *doc); ~KateCSmartIndent (); @@ -363,6 +373,8 @@ class KatePythonIndent : public KateNormalIndent { + Q_OBJECT + public: KatePythonIndent (KateDocument *doc); ~KatePythonIndent (); @@ -381,6 +393,8 @@ class KateXmlIndent : public KateNormalIndent { + Q_OBJECT + public: KateXmlIndent (KateDocument *doc); ~KateXmlIndent (); @@ -408,6 +422,8 @@ class KateCSAndSIndent : public KateNormalIndent { + Q_OBJECT + public: KateCSAndSIndent (KateDocument *doc); ~KateCSAndSIndent (); @@ -467,9 +483,10 @@ * The idea is to provide a somewhat intelligent indentation for perl, php, * bash, scheme and in general formats with humble indentation needs. */ -class KateVarIndent : public QObject, public KateNormalIndent +class KateVarIndent : public KateNormalIndent { Q_OBJECT + public: /** * Purely for readability, couples we know and love @@ -519,6 +536,8 @@ class KateScriptIndent : public KateNormalIndent { + Q_OBJECT + public: KateScriptIndent( KateDocument *doc ); ~KateScriptIndent(); *** Bug 133087 has been marked as a duplicate of this bug. *** |