Skip to content
Snippets Groups Projects
Commit 44cefd73 authored by Leandro Melo's avatar Leandro Melo
Browse files

Text editor: Fix potential crash in the plain text editor.

Example situation: The plain text editor is displaying in-memory content and
has not been explicitly "configured". If there's an attempt to indent the text
it crashes since the indenter is invalid. This can happen if one clicks on 'Show
View Contents in Editor' within a debug session and press enter in the editor.

Reviewed-by: con
parent 47310350
No related branches found
No related tags found
No related merge requests found
...@@ -63,7 +63,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor) ...@@ -63,7 +63,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor)
PlainTextEditor::PlainTextEditor(QWidget *parent) PlainTextEditor::PlainTextEditor(QWidget *parent)
: BaseTextEditor(parent), : BaseTextEditor(parent),
m_isMissingSyntaxDefinition(false), m_isMissingSyntaxDefinition(false),
m_ignoreMissingSyntaxDefinition(false) m_ignoreMissingSyntaxDefinition(false),
m_indenter(new NormalIndenter) // Currently only "normal" indentation is supported.
{ {
setRevisionsVisible(true); setRevisionsVisible(true);
setMarksVisible(true); setMarksVisible(true);
...@@ -199,11 +200,6 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType) ...@@ -199,11 +200,6 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType)
setFontSettings(TextEditorSettings::instance()->fontSettings()); setFontSettings(TextEditorSettings::instance()->fontSettings());
// @todo: Indentation specification through the definition files is not really being used
// because Kate recommends to configure indentation through another feature. Maybe we should
// provide something similar in Creator? For now, only normal indentation is supported.
m_indenter.reset(new NormalIndenter);
emit configured(editableInterface()); emit configured(editableInterface());
} }
......
...@@ -96,8 +96,8 @@ private: ...@@ -96,8 +96,8 @@ private:
bool m_isMissingSyntaxDefinition; bool m_isMissingSyntaxDefinition;
bool m_ignoreMissingSyntaxDefinition; bool m_ignoreMissingSyntaxDefinition;
Utils::CommentDefinition m_commentDefinition;
QScopedPointer<Indenter> m_indenter; QScopedPointer<Indenter> m_indenter;
Utils::CommentDefinition m_commentDefinition;
}; };
} // namespace TextEditor } // namespace TextEditor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment