diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 9c4b014bee..17289b539b 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -429,4 +429,10 @@ Buffer const * Inset::updateFrontend() const return theApp() ? theApp()->updateInset(this) : 0; } + +docstring Inset::completionPrefix(Cursor const &) const +{ + return docstring(); +} + } // namespace lyx diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 52e97929bd..1b50280be5 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -19,10 +19,8 @@ #include "InsetCode.h" #include "support/strfwd.h" +#include "support/types.h" -#include - -#include namespace lyx { @@ -31,6 +29,7 @@ class Buffer; class BufferParams; class BufferView; class Change; +class CompletionList; class Cursor; class CursorSlice; class Dimension; @@ -60,6 +59,14 @@ class EmbeddedFileList; namespace graphics { class PreviewLoader; } +/** returns the InsetCode corresponding to the \c name. +* Eg, insetCode("branch") == BRANCH_CODE +* Implemented in 'Inset.cpp'. +*/ +InsetCode insetCode(std::string const & name); +/// the other way +std::string insetName(InsetCode); + /// Common base class to all insets // Do not add _any_ (non-static) data members as this would inflate @@ -304,20 +311,6 @@ public: /// return true if the inset should be removed automatically virtual bool autoDelete() const; - class CompletionList { - public: - /// - virtual ~CompletionList() {} - /// - virtual bool sorted() const =0; - /// - virtual size_t size() const =0; - /// returns the string shown in the gui. - virtual docstring const & data(size_t idx) const = 0; - /// returns the resource string used to load an icon. - virtual std::string icon(size_t /*idx*/) const { return std::string(); } - }; - /// Returns true if the inset supports completions. virtual bool completionSupported(Cursor const &) const { return false; } /// Returns true if the inset supports inline completions at the @@ -336,8 +329,7 @@ public: { return 0; } /// Returns the completion prefix to filter the suggestions for completion. /// This is only called if completionList returned a non-null list. - virtual docstring completionPrefix(Cursor const &) const - { return docstring(); } + virtual docstring completionPrefix(Cursor const &) const; /// Do a completion at the cursor position. Return true on success. /// The completion does not contain the prefix. If finished is true, the /// completion is final. If finished is false, completion might only be diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index c4effad34e..260bd41bf2 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -56,15 +56,15 @@ vector const init_possible_cite_commands() } -vector const & possible_cite_commands() +vector const & possibleCiteCommands() { static vector const possible = init_possible_cite_commands(); return possible; } -//FIXME See the header for the issue. -string const default_cite_command(biblio::CiteEngine engine) +// FIXME See the header for the issue. +string defaultCiteCommand(biblio::CiteEngine engine) { string str; switch (engine) { @@ -85,10 +85,9 @@ string const default_cite_command(biblio::CiteEngine engine) } -string const - asValidLatexCommand(string const & input, biblio::CiteEngine const engine) +string asValidLatexCommand(string const & input, biblio::CiteEngine const engine) { - string const default_str = default_cite_command(engine); + string const default_str = defaultCiteCommand(engine); if (!InsetCitation::isCompatibleCommand(input)) return default_str; @@ -129,7 +128,7 @@ string const } -docstring getComplexLabel(Buffer const & buffer, +docstring complexLabel(Buffer const & buffer, string const & citeType, docstring const & keyList, docstring const & before, docstring const & after, biblio::CiteEngine engine) @@ -353,7 +352,7 @@ docstring getComplexLabel(Buffer const & buffer, } -docstring const getBasicLabel(docstring const & keyList, docstring const & after) +docstring basicLabel(docstring const & keyList, docstring const & after) { docstring keys = keyList; docstring label; @@ -366,8 +365,9 @@ docstring const getBasicLabel(docstring const & keyList, docstring const & after keys = ltrim(split(keys, key, ',')); label += ", " + key; } - } else + } else { label = keys; + } if (!after.empty()) label += ", " + after; @@ -403,7 +403,7 @@ ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */) bool InsetCitation::isCompatibleCommand(string const & cmd) { - vector const & possibles = possible_cite_commands(); + vector const & possibles = possibleCiteCommands(); vector::const_iterator const end = possibles.end(); return find(possibles.begin(), end, cmd) != end; } @@ -415,13 +415,13 @@ docstring InsetCitation::generateLabel() const docstring const after = getParam("after"); docstring label; - biblio::CiteEngine const engine = buffer().params().getEngine(); - label = getComplexLabel(buffer(), getCmdName(), getParam("key"), + biblio::CiteEngine const engine = buffer().params().citeEngine(); + label = complexLabel(buffer(), getCmdName(), getParam("key"), before, after, engine); // Fallback to fail-safe if (label.empty()) - label = getBasicLabel(getParam("key"), after); + label = basicLabel(getParam("key"), after); return label; } @@ -435,7 +435,7 @@ docstring InsetCitation::screenLabel() const void InsetCitation::updateLabels(ParIterator const &) { - biblio::CiteEngine const engine = buffer().params().getEngine(); + biblio::CiteEngine const engine = buffer().params().citeEngine(); if (cache.params == params() && cache.engine == engine) return; @@ -510,7 +510,7 @@ void InsetCitation::textString(odocstream & os) const // should revert to \cite[]{} int InsetCitation::latex(odocstream & os, OutputParams const &) const { - biblio::CiteEngine cite_engine = buffer().params().getEngine(); + biblio::CiteEngine cite_engine = buffer().params().citeEngine(); // FIXME UNICODE docstring const cite_str = from_utf8( asValidLatexCommand(getCmdName(), cite_engine)); @@ -532,7 +532,7 @@ int InsetCitation::latex(odocstream & os, OutputParams const &) const void InsetCitation::validate(LaTeXFeatures & features) const { - switch (features.bufferParams().getEngine()) { + switch (features.bufferParams().citeEngine()) { case biblio::ENGINE_BASIC: break; case biblio::ENGINE_NATBIB_AUTHORYEAR: diff --git a/src/insets/InsetCode.h b/src/insets/InsetCode.h index 14b6cfa514..5613a031e6 100644 --- a/src/insets/InsetCode.h +++ b/src/insets/InsetCode.h @@ -15,15 +15,8 @@ #ifndef INSETCODE_H #define INSETCODE_H -#include - namespace lyx { -/** This is not quite the correct place for this enum. I think - the correct would be to let each subclass of Inset declare - its own enum code. Actually the notion of an InsetCode - should be avoided, but I am not sure how this could be done - in a cleaner way. */ enum InsetCode { /// NO_CODE, // 0 @@ -127,14 +120,6 @@ enum InsetCode { #endif }; -/** returns the InsetCode corresponding to the \c name. -* Eg, insetCode("branch") == BRANCH_CODE -* Implemented in 'Inset.cpp'. -*/ -InsetCode insetCode(std::string const & name); -/// the other way -std::string insetName(InsetCode); - } // namespace lyx #endif diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 10926c79fc..a3e0cbce24 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -40,10 +40,17 @@ using namespace std; using namespace lyx::support; + namespace lyx { -ParamInfo::ParamData::ParamData(std::string const & s, ParamType t) : - name_(s), type_(t) +///////////////////////////////////////////////////////////////////// +// +// ParamInfo::ParamData +// +///////////////////////////////////////////////////////////////////// + +ParamInfo::ParamData::ParamData(std::string const & s, ParamType t) + : name_(s), type_(t) {} @@ -107,6 +114,13 @@ ParamInfo::ParamData const & } +///////////////////////////////////////////////////////////////////// +// +// InsetCommandParams +// +///////////////////////////////////////////////////////////////////// + + InsetCommandParams::InsetCommandParams(InsetCode code) : insetCode_(code), preview_(false) { @@ -161,6 +175,12 @@ ParamInfo const & InsetCommandParams::findInfo( } +std::string InsetCommandParams::insetType() const +{ + return insetName(insetCode_); +} + + string InsetCommandParams::getDefaultCmd(InsetCode code) { switch (code) { case BIBITEM_CODE: diff --git a/src/insets/InsetCommandParams.h b/src/insets/InsetCommandParams.h index 6cec1ffabc..ef4d9b4c21 100644 --- a/src/insets/InsetCommandParams.h +++ b/src/insets/InsetCommandParams.h @@ -15,9 +15,9 @@ #define INSETCOMMANDPARAMS_H #include "InsetCode.h" + #include "support/docstring.h" -#include #include #include #include @@ -121,7 +121,7 @@ public: explicit InsetCommandParams(InsetCode code, std::string const & cmdName); /// - std::string insetType() const { return insetName(insetCode_); } + std::string insetType() const; /// InsetCode code() const { return insetCode_; } /// diff --git a/src/insets/InsetNewline.h b/src/insets/InsetNewline.h index 48147f6503..04c2e241e2 100644 --- a/src/insets/InsetNewline.h +++ b/src/insets/InsetNewline.h @@ -12,65 +12,72 @@ #ifndef INSET_NEWLINE_H #define INSET_NEWLINE_H - #include "Inset.h" + +#include "support/docstring.h" #include "support/gettext.h" namespace lyx { -class InsetNewline : public Inset { +class InsetNewline : public Inset +{ public: - + /// InsetNewline() {} - + /// InsetCode lyxCode() const { return NEWLINE_CODE; } - + /// void metrics(MetricsInfo &, Dimension &) const; - - virtual void draw(PainterInfo & pi, int x, int y) const; - + /// + void draw(PainterInfo & pi, int x, int y) const; + /// int latex(odocstream &, OutputParams const &) const; - + /// int plaintext(odocstream &, OutputParams const &) const; - + /// int docbook(odocstream &, OutputParams const &) const; - - virtual void read(Lexer & lex); - - virtual void write(std::ostream & os) const; + /// + void read(Lexer & lex); + /// + void write(std::ostream & os) const; /// We don't need \begin_inset and \end_inset - virtual bool directWrite() const { return true; } + bool directWrite() const { return true; } /// is this equivalent to a space (which is BTW different from /// a line separator)? bool isSpace() const; - - virtual docstring insetLabel() const { return docstring(); } - - virtual std::string getLyXName() const { return "\\newline"; } - - virtual std::string getCmdName() const { return "\\\\"; } - - virtual ColorCode ColorName() const { return Color_eolmarker; } + /// + docstring insetLabel() const { return docstring(); } + /// + std::string getLyXName() const { return "\\newline"; } + /// + std::string getCmdName() const { return "\\\\"; } + /// + ColorCode ColorName() const { return Color_eolmarker; } private: + /// Inset * clone() const { return new InsetNewline(*this); } }; -class InsetLinebreak : public InsetNewline { + +class InsetLinebreak : public InsetNewline +{ public: + /// InsetLinebreak() {} - + /// docstring insetLabel() const { return _("line break"); } - + /// std::string getLyXName() const { return "\\linebreak"; } - + /// std::string getCmdName() const { return "\\linebreak{}"; } - + /// ColorCode ColorName() const { return Color_pagebreak; } private: - virtual Inset * clone() const { return new InsetLinebreak(*this); } + /// + Inset * clone() const { return new InsetLinebreak(*this); } }; diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp index 370a7b4363..f9c75b1128 100644 --- a/src/insets/InsetNewpage.cpp +++ b/src/insets/InsetNewpage.cpp @@ -27,6 +27,7 @@ using namespace std; + namespace lyx { void InsetNewpage::read( Lexer &) diff --git a/src/insets/InsetNewpage.h b/src/insets/InsetNewpage.h index 57cbf57daa..30c1d408a6 100644 --- a/src/insets/InsetNewpage.h +++ b/src/insets/InsetNewpage.h @@ -12,86 +12,97 @@ #ifndef INSET_NEWPAGE_H #define INSET_NEWPAGE_H - #include "Inset.h" + +#include "support/docstring.h" #include "support/gettext.h" namespace lyx { -class InsetNewpage : public Inset { +class InsetNewpage : public Inset +{ public: + /// InsetNewpage() {} - + /// InsetCode lyxCode() const { return NEWPAGE_CODE; } - + /// void metrics(MetricsInfo &, Dimension &) const; - + /// void draw(PainterInfo & pi, int x, int y) const; - + /// int latex(odocstream &, OutputParams const &) const; - + /// int plaintext(odocstream &, OutputParams const &) const; - + /// int docbook(odocstream &, OutputParams const &) const; - + /// void read(Lexer & lex); - + /// void write(std::ostream & os) const; /// We don't need \begin_inset and \end_inset bool directWrite() const { return true; } - + /// DisplayType display() const { return AlignCenter; } - - virtual docstring insetLabel() const { return _("New Page"); } - - virtual std::string getCmdName() const { return "\\newpage"; } - - virtual ColorCode ColorName() const { return Color_newpage; } - + /// + docstring insetLabel() const { return _("New Page"); } + /// + std::string getCmdName() const { return "\\newpage"; } + /// + ColorCode ColorName() const { return Color_newpage; } private: + /// Inset * clone() const { return new InsetNewpage(*this); } }; -class InsetPagebreak : public InsetNewpage { +class InsetPagebreak : public InsetNewpage +{ public: + /// InsetPagebreak() {} - + /// docstring insetLabel() const { return _("Page Break"); } - + /// std::string getCmdName() const { return "\\pagebreak"; } - + /// ColorCode ColorName() const { return Color_pagebreak; } - private: - virtual Inset * clone() const { return new InsetPagebreak(*this); } + /// + Inset * clone() const { return new InsetPagebreak(*this); } }; -class InsetClearPage : public InsetNewpage { +class InsetClearPage : public InsetNewpage +{ public: + /// InsetClearPage() {} - + /// docstring insetLabel() const { return _("Clear Page"); } - + /// std::string getCmdName() const { return "\\clearpage"; } private: - virtual Inset * clone() const { return new InsetClearPage(*this); } + /// + Inset * clone() const { return new InsetClearPage(*this); } }; -class InsetClearDoublePage : public InsetNewpage { +class InsetClearDoublePage : public InsetNewpage +{ public: + /// InsetClearDoublePage() {} - + /// docstring insetLabel() const { return _("Clear Double Page"); } - + /// std::string getCmdName() const { return "\\cleardoublepage"; } private: - virtual Inset * clone() const { return new InsetClearDoublePage(*this); } + /// + Inset * clone() const { return new InsetClearDoublePage(*this); } }; } // namespace lyx diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 96a6047d80..c1c1edc3b8 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -88,7 +88,7 @@ InsetQuotes::InsetQuotes(string const & str) } -InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t) +InsetQuotes::InsetQuotes(QuoteLanguage l, QuoteSide s, QuoteTimes t) : language_(l), side_(s), times_(t) { } @@ -97,14 +97,14 @@ InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t) InsetQuotes::InsetQuotes(Buffer const & buf, char_type c) : language_(buf.params().quotes_language), times_(buf.params().quotes_times) { - getPosition(c); + setSide(c); } -InsetQuotes::InsetQuotes(char_type c, quote_language l, quote_times t) +InsetQuotes::InsetQuotes(char_type c, QuoteLanguage l, QuoteTimes t) : language_(l), times_(t) { - getPosition(c); + setSide(c); } @@ -114,17 +114,17 @@ docstring InsetQuotes::name() const } -void InsetQuotes::getPosition(char_type c) +void InsetQuotes::setSide(char_type c) { // Decide whether left or right switch (c) { case ' ': case '(': case '[': - side_ = LeftQ; // left quote + side_ = LeftQuote; // left quote break; default: - side_ = RightQ; // right quote + side_ = RightQuote; // right quote } } @@ -142,48 +142,48 @@ void InsetQuotes::parseString(string const & s) for (i = 0; i < 6; ++i) { if (str[0] == language_char[i]) { - language_ = quote_language(i); + language_ = QuoteLanguage(i); break; } } if (i >= 6) { lyxerr << "ERROR (InsetQuotes::InsetQuotes):" " bad language specification." << endl; - language_ = EnglishQ; + language_ = EnglishQuotes; } for (i = 0; i < 2; ++i) { if (str[1] == side_char[i]) { - side_ = quote_side(i); + side_ = QuoteSide(i); break; } } if (i >= 2) { lyxerr << "ERROR (InsetQuotes::InsetQuotes):" " bad side specification." << endl; - side_ = LeftQ; + side_ = LeftQuote; } for (i = 0; i < 2; ++i) { if (str[2] == times_char[i]) { - times_ = quote_times(i); + times_ = QuoteTimes(i); break; } } if (i >= 2) { lyxerr << "ERROR (InsetQuotes::InsetQuotes):" " bad times specification." << endl; - times_ = DoubleQ; + times_ = DoubleQuotes; } } -docstring InsetQuotes::dispString() const +docstring InsetQuotes::displayString() const { Language const * loclang = buffer().params().language; string disp; disp += quote_char[quote_index[side_][language_]]; - if (times_ == DoubleQ) + if (times_ == DoubleQuotes) disp += disp; @@ -215,8 +215,8 @@ docstring InsetQuotes::dispString() const retdisp = from_ascii(disp); // in french, spaces are added inside double quotes - if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) { - if (side_ == LeftQ) + if (times_ == DoubleQuotes && prefixIs(loclang->code(), "fr")) { + if (side_ == LeftQuote) retdisp += ' '; else retdisp.insert(size_t(0), 1, ' '); @@ -236,7 +236,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const dim.wid = 0; // FIXME: should we add a language or a font parameter member? - docstring const text = dispString(); + docstring const text = displayString(); for (string::size_type i = 0; i < text.length(); ++i) { if (text[i] == ' ') dim.wid += fm.width('i'); @@ -251,7 +251,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const void InsetQuotes::draw(PainterInfo & pi, int x, int y) const { // FIXME: should we add a language or a font parameter member? - docstring const text = dispString(); + docstring const text = displayString(); if (text.length() == 2 && text[0] == text[1]) { pi.pain.text(x, y, text[0], pi.base.font); @@ -290,9 +290,9 @@ int InsetQuotes::latex(odocstream & os, OutputParams const & runparams) const const int quoteind = quote_index[side_][language_]; string qstr; - if (language_ == FrenchQ && times_ == DoubleQ + if (language_ == FrenchQuotes && times_ == DoubleQuotes && prefixIs(runparams.local_font->language()->code(), "fr")) { - if (side_ == LeftQ) + if (side_ == LeftQuote) qstr = "\\og "; //the spaces are important here else qstr = " \\fg{}"; //and here @@ -319,7 +319,7 @@ int InsetQuotes::latex(odocstream & os, OutputParams const & runparams) const int InsetQuotes::plaintext(odocstream & os, OutputParams const &) const { - docstring const str = dispString(); + docstring const str = displayString(); os << str; return str.size(); } @@ -327,13 +327,13 @@ int InsetQuotes::plaintext(odocstream & os, OutputParams const &) const int InsetQuotes::docbook(odocstream & os, OutputParams const &) const { - if (times_ == DoubleQ) { - if (side_ == LeftQ) + if (times_ == DoubleQuotes) { + if (side_ == LeftQuote) os << "“"; else os << "”"; } else { - if (side_ == LeftQ) + if (side_ == LeftQuote) os << "‘"; else os << "’"; @@ -344,7 +344,7 @@ int InsetQuotes::docbook(odocstream & os, OutputParams const &) const void InsetQuotes::textString(odocstream & os) const { - os << dispString(); + os << displayString(); } @@ -359,7 +359,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const if (!use_babel #endif && lyxrc.fontenc != "T1") { - if (times_ == SingleQ) + if (times_ == SingleQuotes) switch (type) { case ',': features.require("quotesinglbase"); break; case '<': features.require("guilsinglleft"); break; diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index b4cbcc290f..e82b28a80e 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -12,52 +12,47 @@ #ifndef INSET_QUOTES_H #define INSET_QUOTES_H - #include "Inset.h" -#include "support/types.h" +#include "support/docstring.h" namespace lyx { -class BufferParams; -class Language; -class LaTeXFeatures; - - /** Quotes. Used for the various quotes. German, English, French, all either double or single **/ -class InsetQuotes : public Inset { +class InsetQuotes : public Inset +{ public: /// - enum quote_language { + enum QuoteLanguage { /// - EnglishQ, + EnglishQuotes, /// - SwedishQ, + SwedishQuotes, /// - GermanQ, + GermanQuotes, /// - PolishQ, + PolishQuotes, /// - FrenchQ, + FrenchQuotes, /// - DanishQ + DanishQuotes }; /// - enum quote_side { + enum QuoteSide { /// - LeftQ, + LeftQuote, /// - RightQ + RightQuote }; /// - enum quote_times { + enum QuoteTimes { /// - SingleQ, + SingleQuotes, /// - DoubleQ + DoubleQuotes }; /** The constructor works like this: @@ -71,7 +66,7 @@ public: /// Create the right quote inset after character c InsetQuotes(Buffer const & buffer, char_type c); /// Direct access to inner/outer quotation marks - InsetQuotes(char_type c, quote_language l, quote_times t); + InsetQuotes(char_type c, QuoteLanguage l, QuoteTimes t); /// docstring name() const; /// @@ -103,23 +98,23 @@ private: /// Inset * clone() const { return new InsetQuotes(*this); } - /// - quote_language language_; - /// - quote_side side_; - /// - quote_times times_; - /** The parameters of the constructor are the language, the side and the multiplicity of the quote. */ - InsetQuotes(quote_language l, quote_side s, quote_times t); + InsetQuotes(QuoteLanguage l, QuoteSide s, QuoteTimes t); /// Decide whether we need left or right quotation marks - void getPosition(char_type c); + void setSide(char_type c); /// void parseString(std::string const &); /// - docstring dispString() const; + docstring displayString() const; + + /// + QuoteLanguage language_; + /// + QuoteSide side_; + /// + QuoteTimes times_; }; } // namespace lyx diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index ee7b3a299e..0288f36fa4 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -11,38 +11,38 @@ #include #include "InsetText.h" -#include "InsetNewline.h" -#include "Buffer.h" #include "buffer_funcs.h" +#include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" +#include "CompletionList.h" #include "CoordCache.h" -#include "CutAndPaste.h" #include "Cursor.h" +#include "CutAndPaste.h" #include "DispatchResult.h" #include "ErrorList.h" #include "FuncRequest.h" #include "InsetList.h" #include "Intl.h" -#include "lyxfind.h" #include "Lexer.h" +#include "lyxfind.h" #include "LyXRC.h" -#include "Text.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_latex.h" +#include "OutputParams.h" #include "output_plaintext.h" -#include "Paragraph.h" #include "paragraph_funcs.h" +#include "Paragraph.h" #include "ParagraphParameters.h" #include "ParIterator.h" #include "Row.h" #include "sgml.h" -#include "TextClass.h" -#include "TextMetrics.h" #include "TexRow.h" +#include "TextClass.h" +#include "Text.h" +#include "TextMetrics.h" #include "WordList.h" #include "frontends/alert.h" @@ -66,7 +66,7 @@ namespace lyx { using graphics::PreviewLoader; -class TextCompletionList : public Inset::CompletionList +class TextCompletionList : public CompletionList { public: /// @@ -529,13 +529,9 @@ bool InsetText::automaticPopupCompletion() const } -Inset::CompletionList const * InsetText::createCompletionList( - Cursor const & cur) const +CompletionList const * InsetText::createCompletionList(Cursor const & cur) const { - if (!completionSupported(cur)) - return 0; - - return new TextCompletionList(cur); + return completionSupported(cur) ? new TextCompletionList(cur) : 0; }