diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index b320d9c316..2f58f3b48a 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -111,7 +111,6 @@ LexerKeyword lyxrcTags[] = { { "\\kbmap", LyXRC::RC_KBMAP }, { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY }, { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY }, - { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH }, { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN }, { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END }, { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN }, @@ -314,7 +313,6 @@ void LyXRC::setDefaults() mac_like_word_movement = false; macro_edit_style = MACRO_EDIT_INLINE_BOX; dialogs_iconify_with_main = false; - label_init_length = 3; preview = PREVIEW_OFF; preview_hashed_labels = false; preview_scale_factor = 1.0; @@ -1077,10 +1075,6 @@ int LyXRC::read(Lexer & lexrc) lexrc >> gui_language; break; - case RC_LABEL_INIT_LENGTH: - lexrc >> label_init_length; - break; - case RC_SHOW_BANNER: lexrc >> show_banner; break; @@ -1523,14 +1517,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; - case RC_LABEL_INIT_LENGTH: - if (ignore_system_lyxrc || - label_init_length != system_lyxrc.label_init_length) { - os << "\\label_init_length " << label_init_length - << '\n'; - } - if (tag != RC_LAST) - break; case RC_USER_NAME: os << "\\user_name \"" << user_name << "\"\n"; @@ -2708,7 +2694,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_KBMAP: case LyXRC::RC_KBMAP_PRIMARY: case LyXRC::RC_KBMAP_SECONDARY: - case LyXRC::RC_LABEL_INIT_LENGTH: case LyXRC::RC_LANGUAGE_AUTO_BEGIN: case LyXRC::RC_LANGUAGE_AUTO_END: case LyXRC::RC_LANGUAGE_COMMAND_BEGIN: @@ -2963,10 +2948,6 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard."); break; - case RC_LABEL_INIT_LENGTH: - str = _("Maximum number of words in the initialization string for a new label"); - break; - case RC_LANGUAGE_AUTO_BEGIN: str = _("Select if a language switching command is needed at the beginning of the document."); break; diff --git a/src/LyXRC.h b/src/LyXRC.h index 3847f96c78..45e203af7e 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -96,7 +96,6 @@ public: RC_KBMAP, RC_KBMAP_PRIMARY, RC_KBMAP_SECONDARY, - RC_LABEL_INIT_LENGTH, RC_LANGUAGE_AUTO_BEGIN, RC_LANGUAGE_AUTO_END, RC_LANGUAGE_COMMAND_BEGIN, @@ -417,8 +416,6 @@ public: /// bool dialogs_iconify_with_main; /// - int label_init_length; - /// bool display_graphics; /// bool show_banner; diff --git a/src/Text.cpp b/src/Text.cpp index 8035739390..33932d4e9f 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1834,10 +1834,11 @@ docstring Text::getPossibleLabel(Cursor const & cur) const docstring text; docstring par_text = pars_[pit].asString(); - string piece; - // the return string of math matrices might contain linebreaks + + // The return string of math matrices might contain linebreaks par_text = subst(par_text, '\n', '-'); - for (int i = 0; i < lyxrc.label_init_length; ++i) { + int const numwords = 3; + for (int i = 0; i < numwords; ++i) { if (par_text.empty()) break; docstring head; @@ -1847,12 +1848,13 @@ docstring Text::getPossibleLabel(Cursor const & cur) const text += '-'; text += head; } + + // Make sure it isn't too long + unsigned int const max_label_length = 32; + if (text.size() > max_label_length) + text.resize(max_label_length); - // No need for a prefix if the user said so. - if (lyxrc.label_init_length <= 0) - return text; - - // Will contain the label type. + // Will contain the label prefix. docstring name; // For section, subsection, etc... @@ -1866,7 +1868,7 @@ docstring Text::getPossibleLabel(Cursor const & cur) const if (layout->latextype != LATEX_PARAGRAPH) name = layout->refprefix; - // for captions, we just take the caption type + // For captions, we just take the caption type Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE); if (caption_inset) { string const & ftype = static_cast(caption_inset)->type(); @@ -1886,9 +1888,8 @@ docstring Text::getPossibleLabel(Cursor const & cur) const } if (!name.empty()) - // FIXME - // we should allow customization of the separator or else change it - // once we have refstyle + // FIXME refstyle + // We should allow customization of the separator or else change it text = name + ':' + text; return text; diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 7f4897c8e3..35e4186e2b 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1275,8 +1275,9 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) cur.recordUndoInset(); row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row(); docstring old_label = label(r); - docstring const default_label = from_ascii( - (lyxrc.label_init_length >= 0) ? "eq:" : ""); + // FIXME refstyle + // Allow customization of this separator + docstring const default_label = from_ascii("eq:"); if (old_label.empty()) old_label = default_label;