[LyX/master] Fix bug #12466
commit 777ccce5617aea9b15f27902b9133146eff4e87b Author: Enrico Forestieri Date: Sun Feb 13 04:57:27 2022 +0100 Fix bug #12466 Amend 109ea2be by reintroducing the command prefix that was inadvertently removed. The prefix sets the proper environment for latex. --- src/support/ForkedCalls.cpp |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/support/ForkedCalls.cpp b/src/support/ForkedCalls.cpp index e770c4d..b946215 100644 --- a/src/support/ForkedCalls.cpp +++ b/src/support/ForkedCalls.cpp @@ -305,6 +305,8 @@ int ForkedCall::generateChild() if (command_.empty()) return 1; + string const prefixed_command = cmd_prefix_ + command_; + #if !defined (_WIN32) // POSIX @@ -312,8 +314,8 @@ int ForkedCall::generateChild() // in a contiguous block of memory. The array contains pointers // to each word. // Don't forget the terminating `\0' character. - char const * const c_str = command_.c_str(); - vector vec(c_str, c_str + command_.size() + 1); + char const * const c_str = prefixed_command.c_str(); + vector vec(c_str, c_str + prefixed_command.size() + 1); // Splitting the command up into an array of words means replacing // the whitespace between words with '\0'. Life is complicated @@ -377,7 +379,7 @@ int ForkedCall::generateChild() if (lyxerr.debugging(Debug::FILES)) { vector::iterator ait = argv.begin(); vector::iterator const aend = argv.end(); - lyxerr << "\n\t" << command_ + lyxerr << "\n\t" << prefixed_command << "\n\tInterpreted as:\n\n"; for (; ait != aend; ++ait) if (*ait) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Avoid a Qt warning about bad svg
commit 94a7f74423570e247fdc23ebd1aa0bf5bc7a31d7 Author: Enrico Forestieri Date: Thu Feb 17 14:59:17 2022 +0100 Avoid a Qt warning about bad svg See #10384 for the details. --- lib/images/busy.svgz | Bin 327 -> 326 bytes 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/lib/images/busy.svgz b/lib/images/busy.svgz index 2a07dfa..2772df5 100644 Binary files a/lib/images/busy.svgz and b/lib/images/busy.svgz differ -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Compile fix
commit 8496b7dc9ae6fff7c35446f00c1fb937e399ddea Author: Enrico Forestieri Date: Sat Mar 5 02:19:38 2022 +0100 Compile fix --- src/support/os_cygwin.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 5d43737..0261e2c 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -342,7 +342,7 @@ string latex_path(string const & p) if (windows_style_tex_paths_ && FileName::isAbsolute(p)) { string dos_path = convert_path(p, PathStyle(windows)); - LYXERR(Debug::LATEX, " [" + LYXERR(Debug::OUTFILE, " [" << p << "]->>[" << dos_path << ']'); return dos_path; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 3f9e21b8
commit 955308de57822070329a54538d528967c87f0883 Author: Enrico Forestieri Date: Sun Mar 6 23:01:56 2022 +0100 Amend 3f9e21b8 This avoids a compile error on cygwin. --- src/Encoding.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Encoding.h b/src/Encoding.h index 9668336..4913ddc 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -113,10 +113,10 @@ public: private: /// LaTeX commands (text mode) for this character. The first one is the default, the others /// are only present for compatibility other ways users may encode the character - std::vector text_commands_; + std::vector text_commands_; /// LaTeX command (math mode) for this character. The first one is the default, the others // /// are only present for compatibility other ways users may encode the character - std::vector math_commands_; + std::vector math_commands_; /// Needed LaTeX preamble (or feature) for text mode trivstring text_preamble_; /// Needed LaTeX preamble (or feature) for math mode -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Force absolute paths with qmake
commit d7662e5586595ffe562623e792d6e836aedbbbaf Author: Enrico Forestieri Date: Sun May 29 11:57:58 2022 +0200 Force absolute paths with qmake When generating makefiles, by default qmake tries to use relative paths if it can replace at most 4 subdirs with "../" to reach the QTDIR from the project file location. This maximum can be changed by defining QMAKE_PROJECT_DEPTH, and setting it to zero forces qmake to always use absolute paths. This is necessary because the paths for includes and libs are generated by a temporary project file located in a temporary dir not corresponding to the real source dir. --- config/qt.m4 |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/config/qt.m4 b/config/qt.m4 index 8c1a818..2cd4263 100644 --- a/config/qt.m4 +++ b/config/qt.m4 @@ -424,6 +424,7 @@ qtHaveModule(core5compat): QT += core5compat percent.target = % percent.commands = @echo -n "\$(\$(@))\ " QMAKE_EXTRA_TARGETS += percent +QMAKE_PROJECT_DEPTH = 0 EOF1 $QT_QMAKE $lyx_test_qt_pro -o $lyx_test_qt_mak 1>/dev/null 2>&1 QT_CORE_INCLUDES=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak INCPATH | sed 's/-I\. //g'` @@ -452,6 +453,7 @@ qtHaveModule(widgets): QT += widgets percent.target = % percent.commands = @echo -n "\$(\$(@))\ " QMAKE_EXTRA_TARGETS += percent +QMAKE_PROJECT_DEPTH = 0 EOF2 $QT_QMAKE $lyx_test_qt_pro -o $lyx_test_qt_mak 1>/dev/null 2>&1 QT_INCLUDES=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak INCPATH | sed 's/-I\. //g'` -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Always validate a macro definition
commit 0aad23015412d6a3a97c73a842079ee22b91ca09 Author: Enrico Forestieri Date: Tue May 31 22:13:52 2022 +0200 Always validate a macro definition If a user-defined macro appears only in the argument of another macro its definition is not validated and this leads to errors. Fixes bug #12524. --- src/mathed/InsetMathMacro.cpp | 35 --- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index d2c35c7..f6efc70 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -967,23 +967,28 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const features.require(data->required()); } - if (name() == "binom") - features.require("binom"); - - // validate the cells and the definition - if (displayMode() == DISPLAY_NORMAL) { - // Don't update requirements if the macro comes from - // the symbols file and has not been redefined. - MathWordList const & words = mathedWordList(); - MathWordList::const_iterator it = words.find(name()); - MacroNameSet macros; - buffer().listMacroNames(macros); - if (it == words.end() || it->second.inset != "macro" - || macros.find(name()) != macros.end()) { - d->definition_.validate(features); + // Validate the cells and the definition. + // However, don't validate the definition if the macro is + // from the symbols file and has not been redefined, because + // in this case the definition is only used for screen display. + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it = words.find(name()); + MacroNameSet macros; + buffer().listMacroNames(macros); + if (it == words.end() || it->second.inset != "macro" + || macros.find(name()) != macros.end()) { + if (displayMode() == DISPLAY_NORMAL) { + d->definition_.validate(features); + } else if (displayMode() == DISPLAY_INIT) { + MathData ar(const_cast(&buffer())); + MacroData const * data = buffer().getMacro(name()); + if (data) { + asArray(data->definition(), ar); + ar.validate(features); + } } - InsetMathNest::validate(features); } + InsetMathNest::validate(features); } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix bug #12561
commit 4a7a19352cabb401052ca9467cf849da78f82f1a Author: Enrico Forestieri Date: Wed Jul 13 19:11:03 2022 +0200 Fix bug #12561 In mathed it is assumed that a labeled line is also implicitly numbered. However, latex allows to label an equation without numbering it. The label is then assigned the value of a nearby numbered one. This commit drops the above mathed assumption in order to allow to import valid latex code with a labeled but not numbered equation line. The screen representation omits the line number and encloses the label in square brackets for further differentiation. However, it is still not possible to label an equation without numbering it using the GUI. --- src/mathed/InsetMathHull.cpp | 23 +++ src/mathed/MathParser.cpp|1 - 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index de01bad..689950d 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -520,9 +520,9 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const int extra_offset = 0; for (row_type row = 0; row < nrows(); ++row) { rowinfo(row).offset[mi.base.bv] += extra_offset; - if (!numbered(row)) - continue; docstring const nl = nicelabel(row); + if (nl.empty()) + continue; Dimension dimnl; mathed_string_dim(mi.base.font, nl, dimnl); int const ind = indent(*mi.base.bv); @@ -925,10 +925,6 @@ void InsetMathHull::label(row_type row, docstring const & label) void InsetMathHull::numbered(row_type row, Numbered num) { numbered_[row] = num; - if (!numbered(row) && label_[row]) { - delete label_[row]; - label_[row] = 0; - } } @@ -1377,8 +1373,11 @@ void InsetMathHull::delCol(col_type col) docstring InsetMathHull::nicelabel(row_type row) const { - if (!numbered(row)) - return docstring(); + if (!numbered(row)) { + if (!label_[row]) + return docstring(); + return '[' + label_[row]->screenLabel() + ']'; + } docstring const & val = numbers_[row]; if (!label_[row]) return '(' + val + ')'; @@ -1686,7 +1685,7 @@ docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex, { docstring res; if (numberedType()) { - if (label_[row] && numbered(row)) { + if (label_[row]) { docstring const name = latex ? escape(label_[row]->getParam("name")) : label_[row]->getParam("name"); @@ -1908,7 +1907,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) // if there is an argument, find the corresponding label, else // check whether there is at least one label. for (row = 0; row != nrows(); ++row) - if (numbered(row) && label_[row] + if (label_[row] && (cmd.argument().empty() || label(row) == cmd.argument())) break; } @@ -2111,12 +2110,12 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, // if there is no argument and we're inside math, we retrieve // the row number from the cursor position. row_type row = (type_ == hullMultline) ? nrows() - 1 : cur.row(); - enabled = numberedType() && label_[row] && numbered(row); + enabled = numberedType() && label_[row]; } else { // if there is an argument, find the corresponding label, else // check whether there is at least one label. for (row_type row = 0; row != nrows(); ++row) { - if (numbered(row) && label_[row] && + if (label_[row] && (cmd.argument().empty() || label(row) == cmd.argument())) { enabled = true; break; diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index 0ba3375..1958900 100644 --- a/src/mathed/MathParser.cpp +++ b/src/m
[LyX/master] Update it.po
commit 6355fceafc2f634ba964fb74722a66ecf66e2804 Author: Enrico Forestieri Date: Thu Jul 14 20:59:47 2022 +0200 Update it.po po/it.gmo | Bin 604422 -> 614744 bytes po/it.po | 7622 - 2 files changed, 4055 insertions(+), 3567 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend f426470a
commit 90551a03ac67a996eff0b9b643d376b4794fe87b Author: Enrico Forestieri Date: Wed Sep 14 20:10:01 2022 +0200 Amend f426470a The synctex option can also be specified by a single dash and any value different from zero will do. --- src/Buffer.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index da630da..8ab86d4 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1119,8 +1119,10 @@ bool Buffer::isSyncTeXenabled() const const string dest = c.to().substr(0,3); if (dest == "dvi" || dest == "pdf") { const string cmd = c.command(); - enabled |= cmd.find("--synctex=1") != string::npos; - if (enabled) break; + enabled |= cmd.find("-synctex=") != string::npos + && cmd.find("-synctex=0") == string::npos; + if (enabled) + break; } } return enabled; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit fbf275b94b2e733f03c27e03c21f926756f1b721 Author: Enrico Forestieri Date: Thu Sep 15 20:53:05 2022 +0200 Update it.po po/it.gmo | Bin 614744 -> 615431 bytes po/it.po | 1563 +++- 2 files changed, 808 insertions(+), 755 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix bug #12580
commit 65b4c3fcd22cc14b58cc2d42ad61cd367481b08b Author: Enrico Forestieri Date: Sun Oct 2 14:59:03 2022 +0200 Fix bug #12580 This amends [4a7a1935/lyxgit]. Before 4a7a1935 it was assumed that a labeled row was also numbered. Hence, when unnumbering a row a label was also deleted. We now have to do this explicitly. --- src/mathed/InsetMathHull.cpp | 23 +++ 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index ec5a58e..0ab06d2 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1825,11 +1825,22 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) //lyxerr << "toggling all numbers" << endl; cur.recordUndoInset(); bool old = numberedType(); - if (type_ == hullMultline) - numbered(nrows() - 1, !old); - else - for (row_type row = 0; row < nrows(); ++row) + if (type_ == hullMultline) { + row_type row = nrows() - 1; + numbered(row, !old); + if (old && label_[row]) { + delete label_[row]; + label_[row] = 0; + } + } else { + for (row_type row = 0; row < nrows(); ++row) { numbered(row, !old); + if (old && label_[row]) { + delete label_[row]; + label_[row] = 0; + } + } + } cur.message(old ? _("No number") : _("Number")); cur.forceBufferUpdate(); @@ -1842,6 +1853,10 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) bool old = numbered(r); cur.message(old ? _("No number") : _("Number")); numbered(r, !old); + if (old && label_[r]) { + delete label_[r]; + label_[r] = 0; + } cur.forceBufferUpdate(); break; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Do not allow pasting backslashes in macro names
commit a11780b59fcb6cdd16b15f9fa4de45d7ddfd1b2a Author: Enrico Forestieri Date: Sun Nov 20 19:01:38 2022 +0100 Do not allow pasting backslashes in macro names Backslashes are not allowed in macro names and LyX enforces this by not allowing entering them by keyboard. However, it was possible to paste them and this may cause crashes (see bug #12596). --- src/mathed/InsetMathNest.cpp |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 54d96d9..70ef185 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -548,6 +548,15 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) topaste = cap::selection(n, make_pair(buffer().params().documentClassPtr(), buffer().params().authors())); } + InsetMath const * im = cur.inset().asInsetMath(); + InsetMathMacro const * macro = im ? im->asMacro() : nullptr; + // do not allow pasting a backslash in the name of a macro + if (macro + && macro->displayMode() == InsetMathMacro::DISPLAY_UNFOLDED + && support::contains(topaste, char_type('\\'))) { + LYXERR0("Removing backslash from pasted string"); + topaste = subst(topaste, from_ascii("\\"), docstring()); + } cur.niceInsert(topaste, parseflg, false); cur.clearSelection(); // bug 393 cur.forceBufferUpdate(); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Do not allow nesting macro names in macro names
commit 1ac2dc208238a28c95275117e2bc90ea651bdf36 Author: Enrico Forestieri Date: Mon Nov 21 18:24:29 2022 +0100 Do not allow nesting macro names in macro names LyX removes a single backslash when it is inserted in a macro name by the keyboard. However if it is followed by another character before moving the cursor, it is retained causing an assertion (bug #12601). --- src/mathed/InsetMathNest.cpp |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 70ef185..673a62d 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1825,9 +1825,15 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) //lyxerr << "starting with macro" << endl; bool reduced = cap::reduceSelectionToOneCell(cur); if (reduced || !cur.selection()) { + InsetMath const * im = cur.inset().asInsetMath(); + InsetMathMacro const * macro = im ? im->asMacro() + : nullptr; + bool in_macro_name = macro + && macro->displayMode() == + InsetMathMacro::DISPLAY_UNFOLDED; cur.recordUndoInset(); docstring const safe = cap::grabAndEraseSelection(cur); - if (!cur.inRegexped()) + if (!cur.inRegexped() && !in_macro_name) cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false))); else cur.niceInsert(createInsetMath("backslash", buf)); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Update it.po
commit b3be437d8b1b94a9ede9b6edad6da20a6b290ea8 Author: Enrico Forestieri Date: Sat Nov 26 23:24:07 2022 +0100 Update it.po po/it.gmo | Bin 537614 -> 539250 bytes po/it.po | 1275 - 2 files changed, 580 insertions(+), 695 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Partial fix for #12605
commit ae961f004b5c9bb10f4cab0f41e5f3c33d7c183a Author: Enrico Forestieri Date: Sat Dec 10 11:31:51 2022 +0100 Partial fix for #12605 The equation number is now correctly generated when using \ref in \tag, but if equations are numbered within sections, the \tag'ed equations in the first sections are numbered wrongly. However, I think this is a preview.sty bug not a lyx one. --- lib/scripts/lyxpreview_tools.py |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/scripts/lyxpreview_tools.py b/lib/scripts/lyxpreview_tools.py index cca359e..1a6b1c1 100644 --- a/lib/scripts/lyxpreview_tools.py +++ b/lib/scripts/lyxpreview_tools.py @@ -293,7 +293,7 @@ def run_latex(latex, latex_file, bibtex = None): latex_status, latex_stdout = run_tex(latex, latex_file) # Rerun latex if necessary progress("Checking if a latex rerun is necessary") -if string_in_file("Warning: Citation", log_file): +if string_in_file("Warning: (Citation|Reference)", log_file): latex_status, latex_stdout = run_tex(latex, latex_file) return latex_status, latex_stdout @@ -312,9 +312,10 @@ def run_tex(tex, tex_file): def string_in_file(string, infile): if not os.path.isfile(infile): return False +string_re = re.compile(string.encode()) f = open(infile, 'rb') for line in f.readlines(): -if string.encode() in line: +if string_re.search(line): f.close() return True f.close() -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Update it.po
commit eda0aeaed51bf6f816cb02d163f9f31d169c3b6b Author: Enrico Forestieri Date: Sat Dec 10 12:19:15 2022 +0100 Update it.po po/it.gmo | Bin 539250 -> 539628 bytes po/it.po | 1255 - 2 files changed, 568 insertions(+), 687 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit dc976c2b6f6e1f19ee4d884c12abafbdae9e5126 Author: Enrico Forestieri Date: Sat Dec 10 15:18:49 2022 +0100 Update it.po po/it.gmo | Bin 615431 -> 619731 bytes po/it.po | 4085 - 2 files changed, 2164 insertions(+), 1921 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit fff02aca1a3739a3bff19ffa8815a9d4c17f0501 Author: Enrico Forestieri Date: Sat Dec 10 18:55:22 2022 +0100 Update it.po --- po/it.gmo | Bin 619731 -> 620156 bytes po/it.po | 448 - 2 files changed, 234 insertions(+), 214 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 5b8f9e2..3e65046 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index 0a86b01..3d7a6bd 100644 --- a/po/it.po +++ b/po/it.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" -"POT-Creation-Date: 2022-12-10 12:21+0100\n" -"PO-Revision-Date: 2022-12-10 15:07+0100\n" +"POT-Creation-Date: 2022-12-10 18:36+0100\n" +"PO-Revision-Date: 2022-12-10 18:53+0100\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" @@ -587,7 +587,7 @@ msgstr "Ad estensione" #: src/frontends/qt/ui/BoxUi.ui:265 src/frontends/qt/ui/ListingsUi.ui:110 #: src/frontends/qt/ui/TabularUi.ui:344 src/frontends/qt/ui/TabularUi.ui:1553 -#: src/frontends/qt/ui/WrapUi.ui:47 src/frontends/qt/GuiDocument.cpp:1544 +#: src/frontends/qt/ui/WrapUi.ui:47 src/frontends/qt/GuiDocument.cpp:1545 #: src/frontends/qt/GuiParagraph.cpp:115 src/frontends/qt/GuiTabular.cpp:1042 msgid "Left" msgstr "A sinistra" @@ -600,7 +600,7 @@ msgstr "Al centro" #: src/frontends/qt/ui/BoxUi.ui:275 src/frontends/qt/ui/ListingsUi.ui:115 #: src/frontends/qt/ui/TabularUi.ui:354 src/frontends/qt/ui/WrapUi.ui:52 -#: src/frontends/qt/GuiDocument.cpp:1546 src/frontends/qt/GuiParagraph.cpp:116 +#: src/frontends/qt/GuiDocument.cpp:1547 src/frontends/qt/GuiParagraph.cpp:116 #: src/frontends/qt/GuiTabular.cpp:1044 msgid "Right" msgstr "A destra" @@ -762,7 +762,7 @@ msgstr "Aggiungi &tutti" #: src/frontends/qt/ui/BranchesUnknownUi.ui:58 src/Buffer.cpp:1476 #: src/Buffer.cpp:4732 src/Buffer.cpp:4842 src/LyXVC.cpp:114 src/LyXVC.cpp:310 #: src/buffer_funcs.cpp:56 src/frontends/qt/GuiBranches.cpp:226 -#: src/frontends/qt/GuiClipboard.cpp:252 src/frontends/qt/GuiDocument.cpp:2832 +#: src/frontends/qt/GuiClipboard.cpp:252 src/frontends/qt/GuiDocument.cpp:2866 #: src/frontends/qt/GuiParagraph.cpp:177 src/frontends/qt/GuiPrefs.cpp:3416 #: src/frontends/qt/GuiView.cpp:3016 src/frontends/qt/GuiView.cpp:3246 #: src/frontends/qt/GuiView.cpp:3270 src/frontends/qt/GuiView.cpp:3284 @@ -808,16 +808,16 @@ msgstr "&Dimensione:" #: src/frontends/qt/GuiCharacter.cpp:85 src/frontends/qt/GuiCharacter.cpp:98 #: src/frontends/qt/GuiCharacter.cpp:136 src/frontends/qt/GuiCharacter.cpp:147 #: src/frontends/qt/GuiCharacter.cpp:190 src/frontends/qt/GuiCharacter.cpp:241 -#: src/frontends/qt/GuiDocument.cpp:120 src/frontends/qt/GuiDocument.cpp:861 -#: src/frontends/qt/GuiDocument.cpp:881 src/frontends/qt/GuiDocument.cpp:1048 -#: src/frontends/qt/GuiDocument.cpp:1133 src/frontends/qt/GuiDocument.cpp:1179 -#: src/frontends/qt/GuiDocument.cpp:1190 src/frontends/qt/GuiDocument.cpp:1420 -#: src/frontends/qt/GuiDocument.cpp:1538 src/frontends/qt/GuiDocument.cpp:1545 -#: src/frontends/qt/GuiDocument.cpp:2570 src/frontends/qt/GuiDocument.cpp:2657 -#: src/frontends/qt/GuiDocument.cpp:2658 src/frontends/qt/GuiDocument.cpp:2659 -#: src/frontends/qt/GuiDocument.cpp:2683 src/frontends/qt/GuiDocument.cpp:2690 -#: src/frontends/qt/GuiDocument.cpp:2697 src/frontends/qt/GuiDocument.cpp:2787 -#: src/frontends/qt/GuiDocument.cpp:3393 src/frontends/qt/GuiDocument.cpp:4897 +#: src/frontends/qt/GuiDocument.cpp:120 src/frontends/qt/GuiDocument.cpp:862 +#: src/frontends/qt/GuiDocument.cpp:882 src/frontends/qt/GuiDocument.cpp:1049 +#: src/frontends/qt/GuiDocument.cpp:1134 src/frontends/qt/GuiDocument.cpp:1180 +#: src/frontends/qt/GuiDocument.cpp:1191 src/frontends/qt/GuiDocument.cpp:1421 +#: src/frontends/qt/GuiDocument.cpp:1539 src/frontends/qt/GuiDocument.cpp:1546 +#: src/frontends/qt/GuiDocument.cpp:2604 src/frontends/qt/GuiDocument.cpp:2691 +#: src/frontends/qt/GuiDocument.cpp:2692 src/frontends/qt/GuiDocument.cpp:2693 +#: src/frontends/qt/GuiDocument.cpp:2717 src/frontends/qt/GuiDocument.cpp:2724 +#: src/frontends/qt/GuiDocument.cpp:2731 src/frontends/qt/GuiDocument.cpp:2821 +#: src/frontends/qt/GuiDocument.cpp:3427 src/frontends/qt/GuiDocument.cpp:4931 #: src/frontends/qt/GuiExternal.cpp:76 src/frontends/qt/GuiGraphics.cpp:71 #: src/frontends/qt/GuiIndex.cpp:46 src/frontends/qt/GuiIndices.cpp:58 #: src/frontends/qt/GuiListings.cpp:160 src/frontends/qt/GuiListings.cpp:167 @@ -1015,7 +1015,7 @@ msgstr "&Lingua:" #: lib/layouts/europasscv.layout:440 lib/layouts/europasscv.layout:475 #: lib/layouts/europasscv.layout:482 lib/layouts/europecv.layout:321 #: lib/layouts/europecv.layout:327 lib/layouts/moderncv.layout:580
[LyX/master] Amend fb7b7e52
commit d7910e1870c4e8c427d8854cd68af3ef7de85399 Author: Enrico Forestieri Date: Sun Dec 11 12:15:37 2022 +0100 Amend fb7b7e52 pclose() returns -1 only in specific cases, otherwise it returns the exit status of the child, to be retrieved by the macro WEXITSTATUS. --- src/support/filetools.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index e24dcba..f7460ce 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1148,10 +1148,10 @@ cmd_ret const runCommand(string const & cmd) valid = false; #elif defined (HAVE_PCLOSE) int const pret = pclose(inf); - bool const valid = (pret != -1); + bool const valid = (WEXITSTATUS(pret) == 0); #elif defined (HAVE__PCLOSE) int const pret = _pclose(inf); - bool const valid = (pret != -1); + bool const valid = (WEXITSTATUS(pret) == 0); #else #error No pclose() function. #endif -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit c59634b8c7a45ca97f6361e8d72d4bfea8fd737b Author: Enrico Forestieri Date: Sun Dec 11 14:13:47 2022 +0100 Update it.po --- po/it.gmo | Bin 620156 -> 620156 bytes po/it.po | 50 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 3e65046..9ed37a0 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index 3d7a6bd..911ad4a 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2022-12-10 18:36+0100\n" -"PO-Revision-Date: 2022-12-10 18:53+0100\n" +"PO-Revision-Date: 2022-12-11 14:13+0100\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" @@ -27396,8 +27396,8 @@ msgid "" "%1$s is from an older version of LyX and the lyx2lyx script failed to convert " "it." msgstr "" -"Il file %1$s è stato generato da una precedente\n" -"versione di LyX e lo script lyx2lyx non è riuscito a convertirlo." +"Il file %1$s è stato generato da una precedente versione di LyX e lo script " +"lyx2lyx non è riuscito a convertirlo." #: src/Buffer.cpp:1384 #, c-format @@ -27405,8 +27405,8 @@ msgid "" "%1$s is from a newer version of LyX and the lyx2lyx script failed to convert " "it." msgstr "" -"Il file %1$s è stato generato da una versione\n" -"più recente di LyX e lo script lyx2lyx non è riuscito a convertirlo." +"Il file %1$s è stato generato da una versione più recente di LyX e lo script " +"lyx2lyx non è riuscito a convertirlo." #: src/Buffer.cpp:1463 src/Buffer.cpp:4742 src/Buffer.cpp:4851 msgid "File is read-only" @@ -27940,80 +27940,80 @@ msgid "" "The LaTeX package amsmath is only used if AMS formula types or symbols from " "the AMS math toolbars are inserted into formulas" msgstr "" -"Il pacchetto LaTeX amsmath sarà usato solo se comandi\n" -"o simboli AMS vengono inseriti nelle formule" +"Il pacchetto LaTeX amsmath sarà usato solo se comandi o simboli AMS vengono " +"inseriti nelle formule" #: src/BufferParams.cpp:536 msgid "" "The LaTeX package amssymb is only used if symbols from the AMS math toolbars " "are inserted into formulas" msgstr "" -"Il pacchetto LaTeX amssymb sarà usato solo se\n" -"simboli AMS vengono inseriti nelle formule" +"Il pacchetto LaTeX amssymb sarà usato solo se simboli AMS vengono inseriti " +"nelle formule" #: src/BufferParams.cpp:538 msgid "" "The LaTeX package cancel is only used if \\cancel commands are used in " "formulas" msgstr "" -"Il pacchetto LaTeX cancel sarà usato solo se comandi\n" -"\\cancel vengono inseriti nelle formule" +"Il pacchetto LaTeX cancel sarà usato solo se comandi \\cancel vengono " +"inseriti nelle formule" #: src/BufferParams.cpp:540 msgid "" "The LaTeX package esint is only used if special integral symbols are inserted " "into formulas" msgstr "" -"Il pacchetto LaTeX esint sarà usato solo se simboli di\n" -"integrale speciali vengono inseriti nelle formule" +"Il pacchetto LaTeX esint sarà usato solo se simboli di integrale speciali " +"vengono inseriti nelle formule" #: src/BufferParams.cpp:542 msgid "" "The LaTeX package mathdots is only used if the command \\iddots is inserted " "into formulas" msgstr "" -"Il pacchetto LaTeX mathdots sarà usato solo se\n" -"il comando \\iddots viene inserito nelle formule" +"Il pacchetto LaTeX mathdots sarà usato solo se il comando \\iddots viene " +"inserito nelle formule" #: src/BufferParams.cpp:544 msgid "" "The LaTeX package mathtools is only used if some mathematical relations are " "inserted into formulas" msgstr "" -"Il pacchetto LaTeX mathtools sarà usato solo se alcune\n" -"relazioni matematiche vengono inserite nelle formule" +"Il pacchetto LaTeX mathtools sarà usato solo se alcune relazioni matematiche " +"vengono inserite nelle formule" #: src/BufferParams.cpp:546 msgid "" "The LaTeX package mhchem is only used if either the command \\ce or \\cf is " "inserted into formulas" msgstr "" -"Il pacchetto LaTeX mhchem sarà usato solo se i\n" -"comandi \\ce o \\cf vengono inseriti nelle formule"
[LyX/2.3.x] Update it.po
commit 489e0b1cab404a576c8aeced68d8f46a58d22d70 Author: Enrico Forestieri Date: Sun Dec 11 14:26:14 2022 +0100 Update it.po --- po/it.gmo | Bin 539628 -> 539628 bytes po/it.po | 50 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 3e7264e..75ebdde 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index 97467bb..12bd0e3 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2022-12-04 19:23+0100\n" -"PO-Revision-Date: 2022-12-10 12:18+0100\n" +"PO-Revision-Date: 2022-12-11 14:23+0100\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" @@ -25180,8 +25180,8 @@ msgid "" "%1$s is from an older version of LyX and the lyx2lyx script failed to convert " "it." msgstr "" -"Il file %1$s è stato generato da una precedente\n" -"versione di LyX e lo script lyx2lyx non è riuscito a convertirlo." +"Il file %1$s è stato generato da una precedente versione di LyX e lo script " +"lyx2lyx non è riuscito a convertirlo." #: src/Buffer.cpp:1357 #, c-format @@ -25189,8 +25189,8 @@ msgid "" "%1$s is from a newer version of LyX and the lyx2lyx script failed to convert " "it." msgstr "" -"Il file %1$s è stato generato da una versione\n" -"più recente di LyX e lo script lyx2lyx non è riuscito a convertirlo." +"Il file %1$s è stato generato da una versione più recente di LyX e lo script " +"lyx2lyx non è riuscito a convertirlo." #: src/Buffer.cpp:1413 src/Buffer.cpp:4753 src/Buffer.cpp:4842 msgid "File is read-only" @@ -25692,80 +25692,80 @@ msgid "" "The LaTeX package amsmath is only used if AMS formula types or symbols from " "the AMS math toolbars are inserted into formulas" msgstr "" -"Il pacchetto LaTeX amsmath sarà usato solo se comandi\n" -"o simboli AMS vengono inseriti nelle formule" +"Il pacchetto LaTeX amsmath sarà usato solo se comandi o simboli AMS vengono " +"inseriti nelle formule" #: src/BufferParams.cpp:510 msgid "" "The LaTeX package amssymb is only used if symbols from the AMS math toolbars " "are inserted into formulas" msgstr "" -"Il pacchetto LaTeX amssymb sarà usato solo se\n" -"simboli AMS vengono inseriti nelle formule" +"Il pacchetto LaTeX amssymb sarà usato solo se simboli AMS vengono inseriti " +"nelle formule" #: src/BufferParams.cpp:512 msgid "" "The LaTeX package cancel is only used if \\cancel commands are used in " "formulas" msgstr "" -"Il pacchetto LaTeX cancel sarà usato solo se comandi\n" -"\\cancel vengono inseriti nelle formule" +"Il pacchetto LaTeX cancel sarà usato solo se comandi \\cancel vengono " +"inseriti nelle formule" #: src/BufferParams.cpp:514 msgid "" "The LaTeX package esint is only used if special integral symbols are inserted " "into formulas" msgstr "" -"Il pacchetto LaTeX esint sarà usato solo se simboli di\n" -"integrale speciali vengono inseriti nelle formule" +"Il pacchetto LaTeX esint sarà usato solo se simboli di integrale speciali " +"vengono inseriti nelle formule" #: src/BufferParams.cpp:516 msgid "" "The LaTeX package mathdots is only used if the command \\iddots is inserted " "into formulas" msgstr "" -"Il pacchetto LaTeX mathdots sarà usato solo se\n" -"il comando \\iddots viene inserito nelle formule" +"Il pacchetto LaTeX mathdots sarà usato solo se il comando \\iddots viene " +"inserito nelle formule" #: src/BufferParams.cpp:518 msgid "" "The LaTeX package mathtools is only used if some mathematical relations are " "inserted into formulas" msgstr "" -"Il pacchetto LaTeX mathtools sarà usato solo se alcune\n" -"relazioni matematiche vengono inserite nelle formule" +"Il pacchetto LaTeX mathtools sarà usato solo se alcune relazioni matematiche " +"vengono inserite nelle formule" #: src/BufferParams.cpp:520 msgid "" "The LaTeX package mhchem is only used if either the command \\ce or \\cf is " "inserted into formulas" msgstr "" -"Il pacchetto LaTeX mhchem sarà usato solo se i\n" -"comandi \\ce o \\cf vengono inseriti nelle formule"
[LyX/master] Further amend fb7b7e52
commit e18709b176daf7e7db34b89afc240a615764fe78 Author: Enrico Forestieri Date: Sun Dec 11 14:58:42 2022 +0100 Further amend fb7b7e52 This restores the previous behavior of runCommand(). When the child process could not be properly terminated the error "RunCommand: could not terminate child process" was being issued. However, in fb7b7e52 there was a misinterpretation between this condition and the exit status of the child and these two different errors were mixed up. They are now disentangled again. --- src/support/filetools.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index f7460ce..6e9cf34 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1141,11 +1141,13 @@ cmd_ret const runCommand(string const & cmd) DWORD pret; BOOL success = GetExitCodeProcess(process.hProcess, &pret); bool valid = (pret == 0) && success; + if (!success) + pret = -1; if (!infile.empty()) CloseHandle(startup.hStdInput); CloseHandle(process.hProcess); if (fclose(inf) != 0) - valid = false; + pret = -1; #elif defined (HAVE_PCLOSE) int const pret = pclose(inf); bool const valid = (WEXITSTATUS(pret) == 0); @@ -1156,7 +1158,7 @@ cmd_ret const runCommand(string const & cmd) #error No pclose() function. #endif - if (!valid) + if (pret == -1) perror("RunCommand: could not terminate child process"); return { valid, result }; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix bug #12633
commit 16e67d4ebb312a838ca6be4f9b3b43ec5ea212a4 Author: Enrico Forestieri Date: Fri Jan 27 20:34:24 2023 +0100 Fix bug #12633 Avoid recursion when validating a macro that is defined recursively. This avoids a crash but the latex engine will choke on it, of course. --- src/mathed/InsetMathMacro.cpp | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index 1e36f5a..aba4ab7 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -988,8 +988,16 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const MathData ar(const_cast(&buffer())); MacroData const * data = buffer().getMacro(name()); if (data) { - asArray(data->definition(), ar); - ar.validate(features); + // Avoid recursion on a recursive macro definition + docstring const & def = data->definition(); + int pos = tokenPos(def, '\\', name()); + char_type c = def.at(pos + name().size()); + if (pos < 0 || (name().size() > 1 && + ((c >= 'a' && c <= 'z') || +(c >= 'A' && c <= 'Z' { + asArray(def, ar); + ar.validate(features); + } } } } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 16e67d4e
commit 07150cd9286308c893d77cd7748d237544f94225 Author: Enrico Forestieri Date: Fri Jan 27 21:10:02 2023 +0100 Amend 16e67d4e A docstring is not 0-terminated... --- src/mathed/InsetMathMacro.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index aba4ab7..a90bf87 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -991,7 +991,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const // Avoid recursion on a recursive macro definition docstring const & def = data->definition(); int pos = tokenPos(def, '\\', name()); - char_type c = def.at(pos + name().size()); + char_type c = pos + name().size() < def.size() + ? def.at(pos + name().size()) : 0; if (pos < 0 || (name().size() > 1 && ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z' { -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Fix bug #12633
commit 8bc83f123a60615d5bcdb8f15817ba0ca25f2ebf Author: Enrico Forestieri Date: Sat Jan 28 09:03:49 2023 +0100 Fix bug #12633 Avoid recursion when validating a macro that is defined recursively. This avoids a crash but the latex engine will choke on it, of course. --- src/mathed/InsetMathMacro.cpp | 13 +++-- status.23x|1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index 65f677e..50cc3c3 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -917,8 +917,17 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const MathData ar(const_cast(&buffer())); MacroData const * data = buffer().getMacro(name()); if (data) { - asArray(data->definition(), ar); - ar.validate(features); + // Avoid recursion on a recursive macro definition + docstring const & def = data->definition(); + int pos = tokenPos(def, '\\', name()); + char_type c = pos + name().size() < def.size() + ? def.at(pos + name().size()) : 0; + if (pos < 0 || (name().size() > 1 && + ((c >= 'a' && c <= 'z') || +(c >= 'A' && c <= 'Z' { + asArray(def, ar); + ar.validate(features); + } } } InsetMathNest::validate(features); diff --git a/status.23x b/status.23x index c6b4b76..acf0fa9 100644 --- a/status.23x +++ b/status.23x @@ -42,6 +42,7 @@ What's new * USER INTERFACE +- Avoid crashing on a recursive macro definition (bug 12633). * INTERNALS -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 891ba726
commit d213df2f2edc081ba6e672502e008084487f736d Author: Enrico Forestieri Date: Sun Jan 29 18:30:50 2023 +0100 Amend 891ba726 Avoid an assertion when the cursor is at the start of a math hull. --- src/DocIterator.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 94b7792..31a5bff 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -549,7 +549,7 @@ void DocIterator::updateInsets(Inset * inset) size_t const n = slices_.size(); slices_.resize(0); for (size_t i = 0 ; i < n; ++i) { - if (dit[i].empty() && prevMath().lyxCode() == MATH_SCRIPT_CODE) + if (dit[i].empty() && pos() > 0 && prevMath().lyxCode() == MATH_SCRIPT_CODE) // Workaround: With empty optional argument and a trailing script, // we have empty slices in math macro args (#11676) // FIXME: Find real cause! -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix bug #12711
commit 047008224008b2f170f1dff213d9699a6637418b Author: Enrico Forestieri Date: Sun Mar 19 09:34:01 2023 +0100 Fix bug #12711 Add a few missing autocorrect combinations. --- lib/autocorrect |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/autocorrect b/lib/autocorrect index a9c47e1..98a46aa 100644 --- a/lib/autocorrect +++ b/lib/autocorrect @@ -119,6 +119,10 @@ \leftarrow-\longleftarrow \longleftarrow>\longleftrightarrow = >\Rightarrow += <\Leftarrow +\Rightarrow =\Longrightarrow +\Leftarrow=\Longleftarrow +\Longleftarrow>\Longleftrightarrow @ *\circ -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Cycle through arrows with autocorrect
commit 4384ac75ffae706097f93f979c20e4080785649b Author: Enrico Forestieri Date: Sun Mar 19 10:26:08 2023 +0100 Cycle through arrows with autocorrect The way autocorrect is implemented it is not possible to map --> and ==> to \longleftarrow and \Longleftarrow, respectively. One has to type ->- and =>= to that effect, which may be counterintuitive. This commit allows typing -> or => followed by * to cycle through all possible arrows of the same type. --- lib/autocorrect | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/autocorrect b/lib/autocorrect index 98a46aa..a1d6f31 100644 --- a/lib/autocorrect +++ b/lib/autocorrect @@ -124,6 +124,17 @@ \Leftarrow=\Longleftarrow \Longleftarrow>\Longleftrightarrow +\leftarrow*\longleftarrow +\longleftarrow*\longleftrightarrow +\longleftrightarrow * \leftarrow +\rightarrow *\longrightarrow +\longrightarrow *\longleftrightarrow + +\Leftarrow*\Longleftarrow +\Longleftarrow*\Longleftrightarrow +\Longleftrightarrow * \Leftarrow +\Rightarrow *\Longrightarrow +\Longrightarrow *\Longleftrightarrow @ *\circ \circ /\varnothing -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 4384ac75
commit c3be5d1709febd159a4b8c8de2b05920f3249655 Author: Enrico Forestieri Date: Sun Mar 19 10:50:13 2023 +0100 Amend 4384ac75 --- lib/autocorrect |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/autocorrect b/lib/autocorrect index a1d6f31..09833b4 100644 --- a/lib/autocorrect +++ b/lib/autocorrect @@ -121,18 +121,21 @@ = >\Rightarrow = <\Leftarrow \Rightarrow =\Longrightarrow +\Leftarrow>\Leftrightarrow \Leftarrow=\Longleftarrow \Longleftarrow>\Longleftrightarrow \leftarrow*\longleftarrow \longleftarrow*\longleftrightarrow -\longleftrightarrow * \leftarrow +\longleftrightarrow * \leftrightarrow +\leftrightarrow *\leftarrow \rightarrow *\longrightarrow \longrightarrow *\longleftrightarrow \Leftarrow*\Longleftarrow \Longleftarrow*\Longleftrightarrow -\Longleftrightarrow * \Leftarrow +\Longleftrightarrow * \Leftrightarrow +\Leftrightarrow *\Leftarrow \Rightarrow *\Longrightarrow \Longrightarrow *\Longleftrightarrow -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Fix bug #12711
commit 27208273eff9c2b2d188bc456f09f85d0f9674fc Author: Enrico Forestieri Date: Sun Mar 19 23:40:15 2023 +0100 Fix bug #12711 Add a few missing autocorrect combinations and allow cycling through arrows. The way autocorrect is implemented it is not possible to map --> and ==> to \longleftarrow and \Longleftarrow, respectively. One has to type ->- and =>= to that effect, which may be counterintuitive. This commit allows typing -> or => followed by * to cycle through all possible arrows of the same type. --- lib/autocorrect | 18 ++ status.23x |3 +++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/lib/autocorrect b/lib/autocorrect index a9c47e1..09833b4 100644 --- a/lib/autocorrect +++ b/lib/autocorrect @@ -119,7 +119,25 @@ \leftarrow-\longleftarrow \longleftarrow>\longleftrightarrow = >\Rightarrow += <\Leftarrow +\Rightarrow =\Longrightarrow +\Leftarrow>\Leftrightarrow +\Leftarrow=\Longleftarrow +\Longleftarrow>\Longleftrightarrow +\leftarrow*\longleftarrow +\longleftarrow*\longleftrightarrow +\longleftrightarrow * \leftrightarrow +\leftrightarrow *\leftarrow +\rightarrow *\longrightarrow +\longrightarrow *\longleftrightarrow + +\Leftarrow*\Longleftarrow +\Longleftarrow*\Longleftrightarrow +\Longleftrightarrow * \Leftrightarrow +\Leftrightarrow *\Leftarrow +\Rightarrow *\Longrightarrow +\Longrightarrow *\Longleftrightarrow @ *\circ \circ /\varnothing diff --git a/status.23x b/status.23x index 4e48ecf..03bc8da 100644 --- a/status.23x +++ b/status.23x @@ -26,6 +26,9 @@ What's new * USER INTERFACE +- Add a few missing autocorrect combinations and allow cycling through arrows + (bug 12711). + * DOCUMENTATION AND LOCALIZATION -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Re-enable QWindowsMimeMetafile with Qt6
commit 17b24cf480ca864a746cc2cbb808209d8c976a55 Author: Enrico Forestieri Date: Fri Apr 28 23:34:01 2023 +0200 Re-enable QWindowsMimeMetafile with Qt6 Qt 6.5.0 has dropped support for the QWindowsMime class in favor of a new QWindowsMimeConverter class. They say: "If you have implementations of QWindowsMime or QMacMime in Qt 5, then those will almost directly translate to the new APIs but require less boiler-plate code to register the converters with Qt." This may be true, but in practice they break binary compatibility with previous versions. If you used the QWindowsMime class until Qt 6.4 by using boiler-plate code to register the converters with Qt, you now need to modify the sources and recompile. Fantastic! --- src/frontends/qt/GuiApplication.cpp | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index 0fd63a3..1b29eec 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -130,6 +130,11 @@ #if (QT_VERSION >= 0x050400) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) #if (QT_VERSION >= 0x06) +#if (QT_VERSION >= 0x060500) +#include +#define QWINDOWSMIME QWindowsMimeConverter +#define QVARIANTTYPE QMetaType +#else #include #include #include @@ -137,6 +142,7 @@ #define QVARIANTTYPE QMetaType using QWindowsMime = QNativeInterface::Private::QWindowsMime; using QWindowsApplication = QNativeInterface::Private::QWindowsApplication; +#endif #else #include #define QWINDOWSMIME QWinMime @@ -1031,7 +1037,7 @@ struct GuiApplication::Private #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) /// WMF Mime handler for Windows clipboard. wmf_mime_ = new QWindowsMimeMetafile; - #if (QT_VERSION >= 0x06) + #if (QT_VERSION >= 0x06 && QT_VERSION < 0x060500) win_app_ = dynamic_cast (QGuiApplicationPrivate::platformIntegration()); win_app_->registerMime(wmf_mime_); @@ -1041,7 +1047,7 @@ struct GuiApplication::Private initKeySequences(&theTopLevelKeymap()); } - #if (QT_VERSION >= 0x06) + #if (QT_VERSION >= 0x06 && QT_VERSION < 0x060500) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) ~Private() { @@ -1120,7 +1126,7 @@ struct GuiApplication::Private #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) /// WMF Mime handler for Windows clipboard. QWindowsMimeMetafile * wmf_mime_; -#if (QT_VERSION >= 0x06) +#if (QT_VERSION >= 0x06 && QT_VERSION < 0x060500) QWindowsApplication * win_app_; #endif #endif -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit 2368d70bef61295746a44e9deee165b70d09c8f6 Author: Enrico Forestieri Date: Thu May 4 11:43:43 2023 +0200 Update it.po po/it.gmo | Bin 620156 -> 631397 bytes po/it.po | 5236 - 2 files changed, 2733 insertions(+), 2503 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Use black as default color for an inset button label text
commit ee9fca42bbbc5422e3f36cfe763b437ceeae1a94 Author: Enrico Forestieri Date: Tue May 9 11:33:13 2023 +0200 Use black as default color for an inset button label text It turns out that LyX was using red as default color for the inset button text since ever. However, due to the use of "inherit", the default button text color was black in practice. This was so until [897ee2ed/lyxgit], which made the label font not inherited by default anymore. Hence, all insets that didn't specify a specific label button color started using red as default color. This commit restores the previous behavior and introduces the possibility of modifying this default color. Fixes bug #12771 --- lib/scripts/layout2layout.py |7 +-- src/Color.cpp|1 + src/ColorCode.h |2 ++ src/TextClass.cpp|2 +- src/insets/InsetLayout.h |2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index a8c0ded..e718017 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -11,7 +11,7 @@ # This script will update a .layout file to current format # The latest layout format is also defined in src/TextClass.cpp -currentFormat = 99 +currentFormat = 100 # Incremented to format 4, 6 April 2007, lasgouttes @@ -334,6 +334,9 @@ currentFormat = 99 # Incremented to format 99, 22 December 2022 by tcuvelier # Add DocBookGenerateTitle for Layout +# Incremented to format 100, 9 May 2023 by forenr +# Add inset label color + # Do not forget to document format change in Customization # Manual (section "Declaring a new text class"). @@ -580,7 +583,7 @@ def convert(lines, end_format): i += 1 continue -if 87 <= format <= 98: +if 87 <= format <= 100: # nothing to do. i += 1 continue diff --git a/src/Color.cpp b/src/Color.cpp index bd30ddc..3b9e68e 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -318,6 +318,7 @@ ColorSet::ColorSet() { Color_collapsible, N_("collapsible inset text"), "collapsible", DarkRed, DarkRed, "collapsible" }, { Color_collapsibleframe, N_("collapsible inset frame"), "collapsibleframe", IndianRed, IndianRed, "collapsibleframe" }, { Color_insetbg, N_("inset background"), "insetbg", grey80, grey80, "insetbg" }, + { Color_insetlabel, N_("inset label"), "insetlabel", black, black, "insetlabel" }, { Color_insetframe, N_("inset frame"), "insetframe", IndianRed, IndianRed, "insetframe" }, { Color_error, N_("LaTeX error"), "error", red, DarkRed, "error" }, { Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, Brown, "eolmarker" }, diff --git a/src/ColorCode.h b/src/ColorCode.h index 17f7597..3439c28 100644 --- a/src/ColorCode.h +++ b/src/ColorCode.h @@ -171,6 +171,8 @@ enum ColorCode { Color_insetbg, /// Inset marker frame color Color_insetframe, + /// Inset marker label color + Color_insetlabel, /// Error box text color Color_error, diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 5605418..3db75c1 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -59,7 +59,7 @@ namespace lyx { // You should also run the development/tools/updatelayouts.py script, // to update the format of all of our layout files. // -int const LAYOUT_FORMAT = 99; // tcuvelier: add docbookgeneratetitle +int const LAYOUT_FORMAT = 100; // forenr: add inset label color // Layout format for the current lyx file format. Controls which format is diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 5de781d..4bf84c6 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -55,7 +55,7 @@ enum class InsetLaTeXType : int { class InsetLayout { public: /// - InsetLayout() { labelfont_.setColor(Color_error); } + InsetLayout() { labelfont_.setColor(Color_insetlabel); } /// bool read(Lexer & lexrc, TextClass const & tclass, bool validating = false); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update layouts
commit a401b26640025ed2b00f35af180604ccfaed805f Author: Enrico Forestieri Date: Tue May 9 12:10:45 2023 +0200 Update layouts lib/citeengines/basic.citeengine |2 +- lib/citeengines/biblatex-natbib.citeengine |2 +- lib/citeengines/biblatex.citeengine|2 +- lib/citeengines/jurabib.citeengine |2 +- lib/citeengines/natbib.citeengine |2 +- lib/layouts/AEA.layout |2 +- lib/layouts/IEEEtran-CompSoc.layout|2 +- lib/layouts/IEEEtran-TransMag.layout |2 +- lib/layouts/IEEEtran.layout|2 +- lib/layouts/InStar.module |2 +- lib/layouts/RJournal.layout|2 +- lib/layouts/a0poster.layout|2 +- lib/layouts/aa.layout |2 +- lib/layouts/aapaper.inc|2 +- lib/layouts/aapaper.layout |2 +- lib/layouts/aastex.layout |2 +- lib/layouts/aastex6.layout |2 +- lib/layouts/aastex62.layout|2 +- lib/layouts/achemso.layout |2 +- lib/layouts/acm-sigs-alt.layout|2 +- lib/layouts/acm-sigs.inc |2 +- lib/layouts/acm-sigs.layout|2 +- lib/layouts/acmart.layout |2 +- lib/layouts/acmsiggraph-0-92.layout|2 +- lib/layouts/acmsiggraph.layout |2 +- lib/layouts/agums.layout |2 +- lib/layouts/aguplus.inc|2 +- lib/layouts/agutex.layout |2 +- lib/layouts/algorithm2e.module |2 +- lib/layouts/amsart.layout |2 +- lib/layouts/amsbook.layout |2 +- lib/layouts/amsdefs.inc|2 +- lib/layouts/apa.layout |2 +- lib/layouts/apa6.layout|2 +- lib/layouts/apa7.layout|2 +- lib/layouts/apax.inc |2 +- lib/layouts/arab-article.layout|2 +- lib/layouts/article-beamer.layout |2 +- lib/layouts/article.layout |2 +- lib/layouts/beamer.layout |2 +- lib/layouts/beamerposter.layout|2 +- lib/layouts/bicaption.module |2 +- lib/layouts/book.layout|2 +- lib/layouts/braille.module |2 +- lib/layouts/broadway.layout|2 +- lib/layouts/bxjsarticle.layout |2 +- lib/layouts/bxjsbook.layout|2 +- lib/layouts/bxjsreport.layout |2 +- lib/layouts/bxjsslide.layout |2 +- lib/layouts/chess.layout |2 +- lib/layouts/chessboard.module |2 +- lib/layouts/cl2emult.layout|2 +- lib/layouts/copernicus.layout |2 +- lib/layouts/ctex-article.layout|2 +- lib/layouts/ctex-book.layout |2 +- lib/layouts/ctex-report.layout |2 +- lib/layouts/customHeadersFooters.module|2 +- lib/layouts/db_stdcharstyles.inc |2 +- lib/layouts/db_stdclass.inc|2 +- lib/layouts/db_stdstarsections.inc |2 +- lib/layouts/db_stdstruct.inc |2 +- lib/layouts/db_stdtitle.inc|2 +- lib/layouts/dinbrief.layout|2 +- lib/layouts/docbook-book.layout|2 +- lib/layouts/docbook-chapter.layout |2 +- lib/layouts/docbook-section.layout |2 +- lib/layouts/docbook.layout |2 +- lib/layouts/doublecol-new.layout |2 +- lib/layouts/dtk.layout |2 +- lib/layouts/ectaart.layout |2 +- lib/layouts/egs.layout |2 +- lib/layouts/elsart.layout |2 +- lib/layouts/elsarticle.layout |2 +- lib/layouts/endnotes.module|2 +- lib/layouts/enotez.module |2 +- lib/layouts/entcs.layout |2 +- lib/layouts/enumitem.module|2 +- lib/layouts/eqs-within-sections.module |2 +- lib/layouts
[LyX/master] Use \ifthenelse instead of relying on TeX primitives
commit b135c965f6f33150f648a35607c12daeac1c360e Author: Enrico Forestieri Date: Mon Jun 19 18:17:31 2023 +0200 Use \ifthenelse instead of relying on TeX primitives This fixes the issue reported here: https://www.mail-archive.com/lyx-users@lists.lyx.org/msg115156.html --- lib/scripts/legacy_lyxpreview2ppm.py |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py index 6ee5870..fce5e91 100644 --- a/lib/scripts/legacy_lyxpreview2ppm.py +++ b/lib/scripts/legacy_lyxpreview2ppm.py @@ -252,11 +252,10 @@ def legacy_latex_file(latex_file, fg_color, bg_color): \\definecolor{lyxbg}{rgb}{%s} \\pagecolor{lyxbg} \\usepackage[%s,tightpage]{preview} +\\usepackage{ifthen} +\\ifthenelse{\equal{\f@family}{cmr}}{ +\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{} \\makeatletter -\\def\\t@a{cmr} -\\if\\f@family\\t@a -\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}} -\\fi \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}} \\g@addto@macro\\endpreview{\\endgroup} \\makeatother -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend b135c965
commit c5c03f9be392b0447ceb4d5c3272d07790578380 Author: Enrico Forestieri Date: Mon Jun 19 18:30:23 2023 +0200 Amend b135c965 A macro with @ in its name must be used after \makeatletter --- lib/scripts/legacy_lyxpreview2ppm.py |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py index fce5e91..77a621b 100644 --- a/lib/scripts/legacy_lyxpreview2ppm.py +++ b/lib/scripts/legacy_lyxpreview2ppm.py @@ -253,9 +253,9 @@ def legacy_latex_file(latex_file, fg_color, bg_color): \\pagecolor{lyxbg} \\usepackage[%s,tightpage]{preview} \\usepackage{ifthen} -\\ifthenelse{\equal{\f@family}{cmr}}{ -\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{} \\makeatletter +\\ifthenelse{\\equal{\\f@family}{cmr}}{ +\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{} \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}} \\g@addto@macro\\endpreview{\\endgroup} \\makeatother -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Use \ifthenelse instead of relying on TeX primitives
commit 0ffcff55f302c05a9a0eb1f938be6b23fbcbd5c9 Author: Enrico Forestieri Date: Mon Jun 19 19:53:16 2023 +0200 Use \ifthenelse instead of relying on TeX primitives This fixes the issue reported here: https://www.mail-archive.com/lyx-users@lists.lyx.org/msg115156.html The problem is due to the use of the mathpazo package because it defines the macro \f@family as "ppl\n", i.e., it appends a newline character at the end. Now, the "\if" TeX primitive expands its arguments for comparing them and the newline causes a "missing \begin{document}" error. Instead of complicating the code to account for this, it is better using the ifthen package. --- lib/scripts/legacy_lyxpreview2ppm.py |7 +++ status.23x |2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py index 08703fb..90dccc2 100644 --- a/lib/scripts/legacy_lyxpreview2ppm.py +++ b/lib/scripts/legacy_lyxpreview2ppm.py @@ -252,11 +252,10 @@ def legacy_latex_file(latex_file, fg_color, bg_color): \\definecolor{lyxbg}{rgb}{%s} \\pagecolor{lyxbg} \\usepackage[%s,tightpage]{preview} +\\usepackage{ifthen} \\makeatletter -\\def\\t@a{cmr} -\\if\\f@family\\t@a -\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}} -\\fi +\\ifthenelse{\\equal{\\f@family}{cmr}}{ +\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{} \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}} \\g@addto@macro\\endpreview{\\endgroup} \\makeatother diff --git a/status.23x b/status.23x index cc11a21..efed021 100644 --- a/status.23x +++ b/status.23x @@ -52,6 +52,8 @@ What's new - Avoid crashing on a recursive macro definition (bug 12633). +- Fix issue with on-screen instant preview and the mathpazo package. + * INTERNALS -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit c15a9d86f966774b83aed9747131336b05890fc2 Author: Enrico Forestieri Date: Sun Jun 25 12:23:03 2023 +0200 Update it.po po/it.gmo | Bin 631397 -> 631617 bytes po/it.po | 1628 +++-- 2 files changed, 825 insertions(+), 803 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Honor pending spaces in InsetMathChar::write
commit befe2da495bf24d651c81bb35fbcda5976f09077 Author: Enrico Forestieri Date: Wed Jun 28 21:17:26 2023 +0200 Honor pending spaces in InsetMathChar::write The InsetMathChar::write() method directly accesses the otexrowstream underlying the TeXMathStream class for writing a character, thus shortcircuiting the mechanism that allows to separate a macro from the following material. It has to do so because directly writing a char_type would cause printing its numerical value instead of the corresponding unicode character in systems where char_type is typedef'd to uint32_t. This problem has been uncovered by [7441172d/lyxgit] because each atom of a mathed cell was being separately written to the output instead of using the lyx::write() method in MathExtern.cpp that simply converts everything to a docstring. As InsetMathChar::write() is the only method bypassing the TeXMathStream machanism, it is simpler teaching it to honor the pending space instead of modifying the code in InsetMathColor. This commit amends 7441172d. --- src/mathed/InsetMathChar.cpp |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp index 483bbb8..d923d04 100644 --- a/src/mathed/InsetMathChar.cpp +++ b/src/mathed/InsetMathChar.cpp @@ -195,6 +195,11 @@ void InsetMathChar::drawT(TextPainter & pain, int x, int y) const void InsetMathChar::write(TeXMathStream & os) const { + if (os.latex() && os.pendingSpace()) { + if (isAlphaASCII(char_)) + os.os() << ' '; + os.pendingSpace(false); + } os.os().put(char_); } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Give error if a required Qt6 module is missing
commit 99f972e2c4494c308546091d0f5e6ba107214415 Author: Enrico Forestieri Date: Sat Jul 15 15:25:33 2023 +0200 Give error if a required Qt6 module is missing Configure would not stop in such cases and a subsequent make would fail. --- config/qt.m4 | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/qt.m4 b/config/qt.m4 index aa90d56..e738723 100644 --- a/config/qt.m4 +++ b/config/qt.m4 @@ -414,12 +414,13 @@ EOF1 AC_SUBST(QT_CORE_LDFLAGS) AC_SUBST(QT_CORE_LIB) cat > $lyx_test_qt_pro << EOF2 -qtHaveModule(core):QT += core -qtHaveModule(concurrent): QT += concurrent -qtHaveModule(gui): QT += gui gui-private -qtHaveModule(svg): QT += svg -qtHaveModule(svgwidgets): QT += svgwidgets -qtHaveModule(widgets): QT += widgets +QMAKE_EXTRA_VARIABLES = MISSING +qtHaveModule(core) {QT += core} else {MISSING += core} +qtHaveModule(concurrent) {QT += concurrent} else {MISSING += concurrent} +qtHaveModule(gui) {QT += gui gui-private} else {MISSING += gui} +qtHaveModule(svg) {QT += svg} else {MISSING += svg} +qtHaveModule(svgwidgets) {QT += svgwidgets} else {MISSING += svgwidgets} +qtHaveModule(widgets) {QT += widgets} else {MISSING += widgets} percent.target = % percent.commands = @echo -n "\$(\$(@))\ " QMAKE_EXTRA_TARGETS += percent @@ -439,6 +440,10 @@ EOF2 if test -z "$QT_LIB"; then AC_MSG_RESULT(no) else + QT_MISSING=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak EXPORT_MISSING | sed 's/^ *//'` + if test -n "$QT_MISSING"; then + AC_MSG_ERROR([Qt6 module(s) $QT_MISSING not found.]) + fi AC_MSG_RESULT(yes) AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LDFLAGS) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Use utf8 strings for previewed labels when possible
commit 4fa0fbe5bfd01bf3878db53852f74478c0f2da5d Author: Enrico Forestieri Date: Thu Aug 10 18:34:17 2023 +0200 Use utf8 strings for previewed labels when possible Fixes bug #12842. --- src/mathed/InsetMathHull.cpp | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index fc7dbe5..9c64180 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1659,10 +1659,16 @@ void InsetMathHull::eol(TeXMathStream & os, row_type row, bool fragile, bool lat bool last_eoln) const { if (numberedType()) { + bool const for_preview = + (os.output() == TeXMathStream::wsPreview); if (label_[row]) { - docstring const name = - latex ? escape(label_[row]->getParam("name")) - : label_[row]->getParam("name"); + // Use utf8 strings for previewed labels when possible + bool use_utf8 = for_preview && + (buffer().params().useNonTeXFonts || +buffer().params().encoding().package() == Encoding::japanese); + docstring const name = (latex && !use_utf8) + ? escape(label_[row]->getParam("name")) + : label_[row]->getParam("name"); os << "\\label{" + name + '}'; } if (type_ != hullMultline) { @@ -1671,7 +1677,7 @@ void InsetMathHull::eol(TeXMathStream & os, row_type row, bool fragile, bool lat else if (numbered_[row] == NOTAG) os<< "\\notag "; } - if (os.output() == TeXMathStream::wsPreview && !numbers_[row].empty()) { + if (for_preview && !numbers_[row].empty()) { os << "\\global\\def\\theequation{" << numbers_[row] << "}\n"; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Load esint when using \dotsint in math.
commit 4fffa458ae9ce2aa0e0a899008abcdea5393f9fd Author: Enrico Forestieri Date: Thu Aug 10 18:43:47 2023 +0200 Load esint when using \dotsint in math. Fixes bug #12863. --- lib/symbols |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/symbols b/lib/symbols index 207741a..abdafd0 100644 --- a/lib/symbols +++ b/lib/symbols @@ -1065,7 +1065,7 @@ endif \def\oiint{\oiintop\nolimits} mathop ∯esint \def\sqint{\sqintop\nolimits} mathop ⨖esint \def\sqiint{\sqiintop\nolimits} mathop esint -\def\dotsint{\dotsintop\nolimits} mathop ∫⋯∫ +\def\dotsint{\dotsintop\nolimits} mathop ∫⋯∫ esint \def\ointctrclockwise{\ointctrclockwiseop\nolimits} mathop ∲ esint \def\ointclockwise{\ointclockwiseop\nolimits} mathop ∲ esint -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix detection of xcb during configure
commit c088cc4413b96fab8fcee2d4f5547d6ddd7fc922 Author: Enrico Forestieri Date: Mon Aug 28 10:52:08 2023 +0200 Fix detection of xcb during configure The QT_FEATURE_xcb macro is not in the private headers anymore. They keep changing APIs... --- config/qt.m4| 11 --- src/frontends/qt/GuiApplication.cpp |2 +- src/frontends/qt/GuiApplication.h |7 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config/qt.m4 b/config/qt.m4 index e738723..b33be23 100644 --- a/config/qt.m4 +++ b/config/qt.m4 @@ -218,16 +218,13 @@ AC_DEFUN([QT_DO_IT_ALL], save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES" AC_CHECK_HEADER(QtGui/qtgui-config.h, - [lyx_qt5_config=QtGui/qtgui-config.h], - [lyx_qt5_config=qconfig.h]) - AC_CHECK_HEADER(QtGui/private/qtgui-config_p.h, - [lyx_qt6_config=QtGui/private/qtgui-config_p.h], - [lyx_qt6_config=qconfig.h]) + [lyx_qt_config=QtGui/qtgui-config.h], + [lyx_qt_config=qconfig.h]) AC_MSG_CHECKING([whether Qt uses the X Window system]) if test x$USE_QT6 = xyes ; then dnl FIXME: Check whether defining QPA_XCB makes sense with Qt6 AC_PREPROC_IFELSE([AC_LANG_SOURCE([ - [#include <$lyx_qt6_config>] + [#include <$lyx_qt_config>] [#if !defined(QT_FEATURE_xcb) || QT_FEATURE_xcb < 0] [#error Fail] [#endif]])], @@ -236,7 +233,7 @@ AC_DEFUN([QT_DO_IT_ALL], [AC_MSG_RESULT(no)]) else AC_EGREP_CPP(xcb, - [#include <$lyx_qt5_config> + [#include <$lyx_qt_config> QT_QPA_DEFAULT_PLATFORM_NAME], [AC_MSG_RESULT(yes) AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])], diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index a237242..57eaaf6 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -3495,7 +3495,7 @@ bool GuiApplication::longOperationStarted() { #if defined(QPA_XCB) bool GuiApplication::nativeEventFilter(const QByteArray & eventType, - void * message, long *) + void * message, QINTPTR *) { if (!current_view_ || eventType != "xcb_generic_event_t") return false; diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h index a77b0c7..b27964d 100644 --- a/src/frontends/qt/GuiApplication.h +++ b/src/frontends/qt/GuiApplication.h @@ -121,8 +121,13 @@ public: bool notify(QObject * receiver, QEvent * event) override; void commitData(QSessionManager & sm); #if defined(QPA_XCB) +#if (QT_VERSION < 0x06) +#define QINTPTR long +#else +#define QINTPTR qintptr +#endif virtual bool nativeEventFilter(const QByteArray & eventType, void * message, - long * result) override; + QINTPTR * result) override; #endif //@} -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix detection of private Qt6 headers
commit 76670a6ab9af0809256dd75cda469a4ded9ab75f Author: Enrico Forestieri Date: Mon Aug 28 11:03:23 2023 +0200 Fix detection of private Qt6 headers The gui-private is a separate module. Private Qt6 GUI headers are currently used only with the Windows backend. However they are needed to port to Qt6 all functionality that was depending on the -extras modules. For example, all code guarded by the macro HAVE_QT5_X11_EXTRAS has to be audited and properly replaced by Qt6 code. See for example 771f30e9 and 17b24cf4. --- config/qt.m4 |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/config/qt.m4 b/config/qt.m4 index b33be23..7e7ffd6 100644 --- a/config/qt.m4 +++ b/config/qt.m4 @@ -414,7 +414,8 @@ EOF1 QMAKE_EXTRA_VARIABLES = MISSING qtHaveModule(core) {QT += core} else {MISSING += core} qtHaveModule(concurrent) {QT += concurrent} else {MISSING += concurrent} -qtHaveModule(gui) {QT += gui gui-private} else {MISSING += gui} +qtHaveModule(gui) {QT += gui} else {MISSING += gui} +qtHaveModule(gui-private) {QT += gui-private} else {MISSING += gui-private} qtHaveModule(svg) {QT += svg} else {MISSING += svg} qtHaveModule(svgwidgets) {QT += svgwidgets} else {MISSING += svgwidgets} qtHaveModule(widgets) {QT += widgets} else {MISSING += widgets} -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit 7cad99347ac5c542f1ef80b4bdd62bb5fb9e1144 Author: Enrico Forestieri Date: Sat Sep 2 15:13:48 2023 +0200 Update it.po po/it.gmo | Bin 631617 -> 638069 bytes po/it.po | 4271 + 2 files changed, 2332 insertions(+), 1939 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit 98eb505c9b30b4e5a6d5c146fd0804dab21b6247 Author: Enrico Forestieri Date: Sat Sep 2 15:42:44 2023 +0200 Update it.po --- po/it.gmo | Bin 638069 -> 638127 bytes po/it.po | 219 +++-- 2 files changed, 112 insertions(+), 107 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 91667ae..1fa3bfe 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index 1843998..4e0d523 100644 --- a/po/it.po +++ b/po/it.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" -"POT-Creation-Date: 2023-09-02 12:36+0200\n" -"PO-Revision-Date: 2023-09-02 14:55+0200\n" +"POT-Creation-Date: 2023-09-02 15:16+0200\n" +"PO-Revision-Date: 2023-09-02 15:39+0200\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" @@ -760,7 +760,7 @@ msgstr "Aggiungi &tutti" #: src/frontends/qt/ui/BranchesUnknownUi.ui:58 src/Buffer.cpp:1483 #: src/Buffer.cpp:4792 src/Buffer.cpp:4902 src/LyXVC.cpp:114 src/LyXVC.cpp:310 #: src/buffer_funcs.cpp:56 src/frontends/qt/GuiBranches.cpp:226 -#: src/frontends/qt/GuiClipboard.cpp:252 src/frontends/qt/GuiDocument.cpp:2964 +#: src/frontends/qt/GuiClipboard.cpp:252 src/frontends/qt/GuiDocument.cpp:2939 #: src/frontends/qt/GuiParagraph.cpp:177 src/frontends/qt/GuiPrefs.cpp:3307 #: src/frontends/qt/GuiPrefs.cpp:3330 src/frontends/qt/GuiView.cpp:2902 #: src/frontends/qt/GuiView.cpp:3065 src/frontends/qt/GuiView.cpp:3295 @@ -812,11 +812,11 @@ msgstr "&Dimensione:" #: src/frontends/qt/GuiDocument.cpp:1165 src/frontends/qt/GuiDocument.cpp:1211 #: src/frontends/qt/GuiDocument.cpp:1224 src/frontends/qt/GuiDocument.cpp:1472 #: src/frontends/qt/GuiDocument.cpp:1590 src/frontends/qt/GuiDocument.cpp:1598 -#: src/frontends/qt/GuiDocument.cpp:2685 src/frontends/qt/GuiDocument.cpp:2772 -#: src/frontends/qt/GuiDocument.cpp:2775 src/frontends/qt/GuiDocument.cpp:2778 -#: src/frontends/qt/GuiDocument.cpp:2810 src/frontends/qt/GuiDocument.cpp:2821 -#: src/frontends/qt/GuiDocument.cpp:2832 src/frontends/qt/GuiDocument.cpp:2919 -#: src/frontends/qt/GuiDocument.cpp:3528 src/frontends/qt/GuiDocument.cpp:5017 +#: src/frontends/qt/GuiDocument.cpp:2660 src/frontends/qt/GuiDocument.cpp:2747 +#: src/frontends/qt/GuiDocument.cpp:2750 src/frontends/qt/GuiDocument.cpp:2753 +#: src/frontends/qt/GuiDocument.cpp:2785 src/frontends/qt/GuiDocument.cpp:2796 +#: src/frontends/qt/GuiDocument.cpp:2807 src/frontends/qt/GuiDocument.cpp:2894 +#: src/frontends/qt/GuiDocument.cpp:3503 src/frontends/qt/GuiDocument.cpp:4992 #: src/frontends/qt/GuiExternal.cpp:76 src/frontends/qt/GuiGraphics.cpp:71 #: src/frontends/qt/GuiIndex.cpp:46 src/frontends/qt/GuiIndices.cpp:58 #: src/frontends/qt/GuiListings.cpp:156 src/frontends/qt/GuiListings.cpp:163 @@ -4527,7 +4527,7 @@ msgstr "" "Seleziona quale pacchetto di lingua (LaTeX) usare per impostazione predefinita" #: src/frontends/qt/ui/PrefLanguageUi.ui:77 -#: src/frontends/qt/GuiDocument.cpp:1082 src/frontends/qt/GuiDocument.cpp:2843 +#: src/frontends/qt/GuiDocument.cpp:1082 src/frontends/qt/GuiDocument.cpp:2818 #: src/frontends/qt/GuiPrefs.cpp:691 src/frontends/qt/GuiPrefs.cpp:719 msgid "Automatic" msgstr "Automatico" @@ -8305,9 +8305,9 @@ msgstr "Affiliazione alt.:" msgid "And" msgstr "Congiunzione" -#: lib/layouts/aastex.layout:256 src/frontends/qt/GuiDocument.cpp:3264 -#: src/frontends/qt/GuiDocument.cpp:3276 src/frontends/qt/GuiDocument.cpp:3405 -#: src/frontends/qt/GuiDocument.cpp:3424 +#: lib/layouts/aastex.layout:256 src/frontends/qt/GuiDocument.cpp:3239 +#: src/frontends/qt/GuiDocument.cpp:3251 src/frontends/qt/GuiDocument.cpp:3380 +#: src/frontends/qt/GuiDocument.cpp:3399 msgid "and" msgstr "e" @@ -12789,8 +12789,8 @@ msgid "Fixme Error" msgstr "Fixme errore" #: lib/layouts/fixme.module:83 src/frontends/qt/GuiCompare.cpp:202 -#: src/frontends/qt/GuiDocument.cpp:2977 src/frontends/qt/GuiDocument.cpp:3051 -#: src/frontends/qt/GuiDocument.cpp:4980 +#: src/frontends/qt/GuiDocument.cpp:2952 src/frontends/qt/GuiDocument.cpp:3026 +#: src/frontends/qt/GuiDocument.cpp:4955 msgid "Error" msgstr "Errore" @@ -17539,7 +17539,7 @@ msgid "List of Listings" msgstr "Elenco dei listati" #: lib/layouts/stdinsets.inc:355 src/frontends/qt/GuiDocument.cpp:1830 -#: src/frontends/qt/GuiDocument.cpp:5003 +#: src/frontends/qt/GuiDocument.cpp:4978 msgid "Listings[[inset]]" msgstr "Listati" @@ -22634,7 +22634,7 @@ msgid "Big operators" msgstr "Operatori grandi" #: lib/ui/stdtoolbars.inc:226 lib/ui/stdtoolbars.inc:693 -#: src/frontends/qt/GuiDocument.cpp:5293
[LyX/master] Fix assertion when canceling file dialog
commit 1cbcb303536800d889a45e8b1f286594987a6686 Author: Enrico Forestieri Date: Sat Sep 2 18:13:31 2023 +0200 Fix assertion when canceling file dialog Without this patch, when a file has to be loaded (for example, after "Document->Settings->Local Class" or "Insert->Graphics") and the file dialog is canceled, both Qt5 and Qt6 assert: ASSERT failure in QList::at: "index out of range" --- src/frontends/qt/FileDialog.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/frontends/qt/FileDialog.cpp b/src/frontends/qt/FileDialog.cpp index 704c34c..be99539 100644 --- a/src/frontends/qt/FileDialog.cpp +++ b/src/frontends/qt/FileDialog.cpp @@ -137,7 +137,8 @@ FileDialog::Result FileDialog::open(QString const & path, FileDialog::Result result; FileDialog::Results results = openMulti(path, filters, suggested, false); result.first = results.first; - result.second = results.second.at(0); + if (result.first != FileDialog::Later) + result.second = results.second.at(0); return result; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Do not change font in html text without gui
commit 12e3d46b5b99904c70ea665f61a795aaa4f3f948 Author: Enrico Forestieri Date: Sat Sep 23 13:41:26 2023 +0200 Do not change font in html text without gui As reported here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg220399.html if an alert is displayed when the gui is not available Qt6 crashes when the text contains html directives and the font is changed. --- src/Converter.cpp |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Converter.cpp b/src/Converter.cpp index b63f771..f9e627b 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -311,16 +311,19 @@ bool Converters::checkAuth(Converter const & conv, string const & doc_fname, bool const has_shell_escape = contains(conv_command, "-shell-escape") || contains(conv_command, "-enable-write18"); if (conv.latex() && has_shell_escape && !use_shell_escape) { + // Only change font if gui is available otherwise Qt6 crashes + string const cmd = use_gui ? "" + conv_command + "" + : conv_command; docstring const shellescape_warning = bformat(_("The following LaTeX backend has been " "configured to allow execution of external programs " "for any document:" - "%1$s" + "%1$s" "This is a dangerous configuration. Please, " "consider using the support offered by LyX for " "allowing this privilege only to documents that " "actually need it, instead."), - from_utf8(conv_command)); + from_utf8(cmd)); frontend::Alert::error(_("Security Warning"), shellescape_warning , false); } else if (!conv.latex()) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 12e3d46b
commit ddf81b4e190deaf40fef2ab44fdbe1cbff63597a Author: Enrico Forestieri Date: Sat Sep 23 16:18:28 2023 +0200 Amend 12e3d46b Also account for alerts regarding documents that are explicitly allowed to execute external commands through the settings. --- src/Converter.cpp | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Converter.cpp b/src/Converter.cpp index f9e627b..881aac6 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -336,21 +336,23 @@ bool Converters::checkAuth(Converter const & conv, string const & doc_fname, ? (has_token ? conv_command.insert(token_pos, "-shell-escape ") : conv_command.append(" -shell-escape")) : conv_command; + // Only change font if gui is available otherwise Qt6 crashes + string const cmd = use_gui ? "" + command + "" : command; docstring const security_warning = (use_shell_escape ? bformat(_("The following LaTeX backend has been requested " "to allow execution of external programs:" - "%1$s" + "%1$s" "The external programs can execute arbitrary commands on " "your system, including dangerous ones, if instructed to do " "so by a maliciously crafted LyX document."), - from_utf8(command)) + from_utf8(cmd)) : bformat(_("The requested operation requires the use of a " "converter from %2$s to %3$s:" - "%1$s" + "%1$s" "This external program can execute arbitrary commands on " "your system, including dangerous ones, if instructed to do " "so by a maliciously crafted LyX document."), - from_utf8(command), from_utf8(conv.from()), + from_utf8(cmd), from_utf8(conv.from()), from_utf8(conv.to(; if (lyxrc.use_converter_needauth_forbidden && !use_shell_escape) { frontend::Alert::error( -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit 7b6fe3555d172b7fecc635445f636101a8493ad6 Author: Enrico Forestieri Date: Sat Sep 23 17:50:25 2023 +0200 Update it.po po/it.gmo | Bin 638127 -> 638088 bytes po/it.po | 1181 +++-- 2 files changed, 595 insertions(+), 586 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Inherit outer font in text-in-math environments
commit d72b9b0238bd33197f0cea4a36d90d78d1cbc666 Author: Enrico Forestieri Date: Wed Nov 1 22:21:49 2023 +0100 Inherit outer font in text-in-math environments The text-in-math environments such as \text, \mbox, \fbox, \makebox and so on, inherit the outer text font. This commit reflects this in the on-screen representation. Fixes #12950. --- src/MetricsInfo.cpp |5 - src/mathed/InsetMathBox.cpp | 12 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 8fe03ba..714e8ad 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -11,6 +11,8 @@ #include #include "MetricsInfo.h" +#include "BufferView.h" +#include "Cursor.h" #include "LyXRC.h" @@ -61,7 +63,8 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = sane_font; + font = isTextFont(name) ? bv->cursor().getFont().fontInfo() + : sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index afaadeb..6feddf9 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -146,14 +146,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x, y); } @@ -196,7 +196,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -210,7 +210,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x + 3, y); } @@ -281,7 +281,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -312,7 +312,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); BufferView const & bv = *pi.base.bv; int w = mathed_char_width(pi.base.font, '['); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Revert "Inherit outer font in text-in-math environments"
commit e0e1350b7e6e26227a73c7d3ddf7a337633cedbf Author: Enrico Forestieri Date: Thu Nov 2 01:59:54 2023 +0100 Revert "Inherit outer font in text-in-math environments" This reverts commit d72b9b0238bd33197f0cea4a36d90d78d1cbc666. Unfortunately, the font taken into account is the font at the current cursor position rather than the font of the corresponding math inset. --- src/MetricsInfo.cpp |5 + src/mathed/InsetMathBox.cpp | 12 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 714e8ad..8fe03ba 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -11,8 +11,6 @@ #include #include "MetricsInfo.h" -#include "BufferView.h" -#include "Cursor.h" #include "LyXRC.h" @@ -63,8 +61,7 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = isTextFont(name) ? bv->cursor().getFont().fontInfo() - : sane_font; + font = sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index 6feddf9..afaadeb 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -146,14 +146,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x, y); } @@ -196,7 +196,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -210,7 +210,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x + 3, y); } @@ -281,7 +281,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -312,7 +312,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); BufferView const & bv = *pi.base.bv; int w = mathed_char_width(pi.base.font, '['); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Revert "Inherit outer font in text-in-math environments"
commit de6d0bfa3fe12a40eab3268e828f4cd10e8a8e32 Author: Enrico Forestieri Date: Thu Nov 2 02:05:13 2023 +0100 Revert "Inherit outer font in text-in-math environments" This reverts commit f0dccbf3fbbf589e2c0a45c286a6581c1949cb28. Unfortunately, the font taken into account is the font at the current cursor position rather than the font at the corresponding math inset. --- src/MetricsInfo.cpp |7 ++- src/mathed/InsetMathBox.cpp | 12 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 106c4c1..1124ed8 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -10,10 +10,8 @@ #include -#include "MetricsInfo.h" #include "BufferView.h" -#include "Cursor.h" - +#include "ColorSet.h" #include "LyXRC.h" #include "MetricsInfo.h" @@ -67,8 +65,7 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = isTextFont(name) ? bv->cursor().getFont().fontInfo() - : sane_font; + font = sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index e6ed811..c0df607 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -81,14 +81,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x, y); } @@ -131,7 +131,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -145,7 +145,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x + 3, y); } @@ -219,7 +219,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -250,7 +250,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); BufferView const & bv = *pi.base.bv; int w = mathed_char_width(pi.base.font, '['); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/2.3.x] Inherit outer font in text-in-math environments
commit a247305b319f4c8051690cff573455d20b7507c7 Author: Enrico Forestieri Date: Thu Nov 2 18:04:04 2023 +0100 Inherit outer font in text-in-math environments Some text-in-math environments such as \text, \mbox, \fbox, and \makebox, inherit the outer text font. This commit reflects this in the on-screen representation. Fixes #12950. --- src/MetricsInfo.cpp |2 +- src/MetricsInfo.h |2 ++ src/RowPainter.cpp |1 + src/TextMetrics.cpp |1 + src/mathed/InsetMathBox.cpp | 12 ++-- status.23x |4 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 1124ed8..1983f99 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -65,7 +65,7 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = sane_font; + font = isTextFont(name) ? outer_font : sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index 1e24779..eb7ba24 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -46,6 +46,8 @@ public: BufferView * bv; /// current font FontInfo font; + /// font of the containing inset + FontInfo outer_font; /// name of current font - mathed specific std::string fontname; /// This is the width available in pixels diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 81769c9..5c19243 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -106,6 +106,7 @@ void RowPainter::paintInset(Row::Element const & e) const pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() : pi_.base.bv->buffer().params().getFont().fontInfo(); + pi_.base.outer_font = e.font.fontInfo(); pi_.ltr_pos = !e.font.isVisibleRightToLeft(); pi_.change_ = change_.changed() ? change_ : e.change; pi_.do_spellcheck &= e.inset->allowSpellCheck(); diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 3769627..ae5b509 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -450,6 +450,7 @@ bool TextMetrics::redoParagraph(pit_type const pit) displayFont(pit, ii->pos) : bufferfont; MacroContext mc(&buffer, parPos); MetricsInfo mi(bv_, font.fontInfo(), w, mc); + mi.base.outer_font = displayFont(pit, ii->pos).fontInfo(); ii->inset->metrics(mi, dim); if (!insetCache.has(ii->inset) || insetCache.dim(ii->inset) != dim) { insetCache.add(ii->inset, dim); diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index c0df607..e6ed811 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -81,14 +81,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x, y); } @@ -131,7 +131,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -145,7 +145,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x + 3, y); } @@ -219,7 +219,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -250,7 +250,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const voi
[LyX/master] Inherit outer font in text-in-math environments
commit 75a08df529c2745a7d5facf740e8f1d4a205bc1f Author: Enrico Forestieri Date: Thu Nov 2 17:54:02 2023 +0100 Inherit outer font in text-in-math environments Some text-in-math environments such as \text, \mbox, \fbox, and \makebox, inherit the outer text font. This commit reflects this in the on-screen representation. Fixes #12950. --- src/MetricsInfo.cpp |2 +- src/MetricsInfo.h |2 ++ src/RowPainter.cpp |1 + src/TextMetrics.cpp |1 + src/mathed/InsetMathBox.cpp | 12 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 8fe03ba..ab55bb5 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -61,7 +61,7 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = sane_font; + font = isTextFont(name) ? outer_font : sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index 09c5b63..293 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -47,6 +47,8 @@ public: BufferView * bv; /// current font FontInfo font; + /// font of the containing inset + FontInfo outer_font; /// name of current font - mathed specific std::string fontname; /// This is the width available in pixels diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 6798d91..d893fd0 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -104,6 +104,7 @@ void RowPainter::paintInset(Row::Element const & e) const pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() : pi_.base.bv->buffer().params().getFont().fontInfo(); + pi_.base.outer_font = e.font.fontInfo(); pi_.ltr_pos = !e.font.isVisibleRightToLeft(); pi_.change = pi_.change.changed() ? pi_.change : e.change; pi_.do_spellcheck &= e.inset->allowSpellCheck(); diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index eb99de0..ba05519 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -520,6 +520,7 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool const align_rows) displayFont(pit, e.pos) : bufferfont; MacroContext mc(&buffer, parPos); MetricsInfo mi(bv_, font.fontInfo(), w, mc, e.pos == 0, tight_); + mi.base.outer_font = displayFont(pit, e.pos).fontInfo(); e.inset->metrics(mi, dim); /* FIXME: This is a kind of hack. This allows InsetMathHull to * state that it needs some elbow room beyond its width, in diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index afaadeb..6feddf9 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -146,14 +146,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x, y); } @@ -196,7 +196,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -210,7 +210,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("textnormal"); + Changer dummy = pi.base.changeFontSet("text"); cell(0).draw(pi, x + 3, y); } @@ -281,7 +281,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("textnormal"); + Changer dummy = mi.base.changeFontSet("text"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -312,7 +312,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) co
[LyX/master] Allow using the text properties dialog in mathed
commit 58103cf214cc5e9e5d0f4aaa03f4250ee011e55a Author: Enrico Forestieri Date: Mon Nov 6 18:04:44 2023 +0100 Allow using the text properties dialog in mathed Until now only the color of the text could be changed by using the text properties dialog. This commit allows changing all other properties except for strikethrough. It is possible to also add underlining with the limitation that the changes accumulate. This requires other work but I think that underlining and strikethrough are not so important in mathed and can be refined at a later time. Fixes #12958 --- lib/symbols| 15 ++ src/Cursor.cpp |1 + src/DocIterator.cpp|3 - src/DocIterator.h |3 +- src/Makefile.am|2 + src/MetricsInfo.cpp| 31 - src/MetricsInfo.h |2 + src/insets/Inset.cpp |1 + src/insets/InsetCode.h | 14 +- src/mathed/InsetMath.h |3 + src/mathed/InsetMathBrace.cpp | 11 +- src/mathed/InsetMathBrace.h|4 + src/mathed/InsetMathDecoration.cpp | 43 +- src/mathed/InsetMathDecoration.h |8 + src/mathed/InsetMathNest.cpp | 255 +++- src/mathed/InsetMathTextsize.cpp | 97 ++ src/mathed/InsetMathTextsize.h | 61 + src/mathed/MathFactory.cpp |3 + src/mathed/MathParser.cpp |2 +- src/mathed/MathSupport.cpp | 31 - 20 files changed, 564 insertions(+), 26 deletions(-) diff --git a/lib/symbols b/lib/symbols index abdafd0..f1fa587 100644 --- a/lib/symbols +++ b/lib/symbols @@ -57,6 +57,7 @@ overleftrightarrow decoration none amsmath overlinedecoration none overrightarrow decoration none tilde decoration none +uline decoration none ulem underbardecoration none underbrace decoration none underleftarrow decoration none amsmath @@ -68,6 +69,8 @@ underrightarrow decoration none amsmath #undertilde decoration none accents undertilde decoration none hiddensymbol utilde decoration none undertilde +uuline decoration none ulem +uwave decoration none ulem vec decoration none widehat decoration none widetilde decoration none @@ -157,6 +160,18 @@ itoldfont nonehiddensymbol rmoldfont nonehiddensymbol ttoldfont nonehiddensymbol +# textsize commands +tiny textsizenonehiddensymbol +scriptsizetextsizenonehiddensymbol +footnotesize textsizenonehiddensymbol +small textsizenonehiddensymbol +normalsizetextsizenonehiddensymbol +large textsizenonehiddensymbol +Large textsizenonehiddensymbol +LARGE textsizenonehiddensymbol +huge textsizenonehiddensymbol +Huge textsizenonehiddensymbol + # matrix environments Bmatrix matrix none Vmatrix matrix none diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 18b0e7f..8cd445b 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1812,6 +1812,7 @@ bool Cursor::macroModeClose(bool cancel) bool keep_mathmode = user_macro || (it != words.end() && (it->second.inset == "font" || it->second.inset == "oldfont" + || it->second.inset == "textsize" || it->second.inset == "mbox")); bool ert_macro = !user_macro && it == words.end() && atomAsMacro; diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 31a5bff..ace4498 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -495,8 +495,6 @@ void DocIterator::backwardPosIgnoreCollapsed() } -#if 0 -// works, but currently not needed void DocIterator::backwardInset() { backwardPos(); @@ -514,7 +512,6 @@ void DocIterator::backwardInset() backwardPos(); } } -#endif bool DocIterator::hasPart(DocIterator const & it) const diff --git a/src/DocIterator.h b/src/DocIterator.h index cfb31f4..9475fcf 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -215,8 +215,7 @@ public: /// move backward one paragraph void backwardPar(); /// move backward one inset - /// not used currently, uncomment if you need it - //void backwardInset(); + void backwardInset(); /// are we some 'extension' (i.e. deeper nested) of the given iterator bool h
[LyX/master] Amend 58103cf2
commit 9d9514752862d2ff9f3019fde0d85a097f073ea9 Author: Enrico Forestieri Date: Mon Nov 6 18:46:22 2023 +0100 Amend 58103cf2 Correct file name. --- src/mathed/InsetMathTextsize.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mathed/InsetMathTextsize.cpp b/src/mathed/InsetMathTextsize.cpp index 97d8234..da80112 100644 --- a/src/mathed/InsetMathTextsize.cpp +++ b/src/mathed/InsetMathTextsize.cpp @@ -1,5 +1,5 @@ /** - * \file InsetMathFontOld.cpp + * \file InsetMathTextsize.cpp * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Silence compiler warning
commit f8f2355445d56b90d43bcec6531be4d7b6b5af41 Author: Enrico Forestieri Date: Mon Nov 6 21:03:23 2023 +0100 Silence compiler warning --- src/mathed/InsetMathNest.cpp |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index c8f5e14..e3572a1 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -552,6 +552,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) case EUFRAK_FAMILY: case RSFS_FAMILY: case STMARY_FAMILY: + case WASY_FAMILY: case ESINT_FAMILY: case INHERIT_FAMILY: case IGNORE_FAMILY: -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 58103cf2
commit ea30f1feb1f058ef8b21eda2e917279de3018650 Author: Enrico Forestieri Date: Wed Nov 8 08:56:40 2023 +0100 Amend 58103cf2 Give a variable a more meaningful name and fix a typo. --- src/mathed/InsetMathNest.cpp | 32 src/mathed/InsetMathTextsize.cpp |2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index e3572a1..d1b033b 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -511,7 +511,7 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) { - bool font_changed = false; + bool include_previous_change = false; cur.recordUndoSelection(); Font font; bool b; @@ -519,7 +519,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) if (font.fontInfo().color() != Color_inherit && font.fontInfo().color() != Color_ignore) { handleNest(cur, MathAtom(new InsetMathColor(buffer_, true, font.fontInfo().color(; - font_changed = true; + include_previous_change = true; } docstring im; @@ -559,7 +559,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty()) { - if (font_changed) { + if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); cur.resetAnchor(); @@ -568,7 +568,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); - font_changed = true; + include_previous_change = true; } switch(font.fontInfo().series()) { @@ -587,7 +587,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty()) { - if (font_changed) { + if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); cur.resetAnchor(); @@ -596,7 +596,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); - font_changed = true; + include_previous_change = true; } switch(font.fontInfo().shape()) { @@ -625,7 +625,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty() && im != "error") { - if (font_changed) { + if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); cur.resetAnchor(); @@ -634,7 +634,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); - font_changed = true; + include_previous_change = true; } switch(font.fontInfo().size()) { @@ -675,7 +675,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty()) { - if (font_changed) { + if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); cur.resetAnchor(); @@ -684,7 +684,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); - font_changed = true; + include_previous_change = true; } InsetMathDecoration const * d = asDecorationInset(); @@ -711,7 +711,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty()) { - if (font_changed) { + if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); cur.resetAnchor(); @@ -720,7 +720,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); - font_changed = true; + include_previous_change = true; } switch(font.font
[LyX/master] Do not accumulate underline changes
commit bdaad03a45276664e65ae4d66ecba8c5d4d91d85 Author: Enrico Forestieri Date: Wed Nov 8 09:17:38 2023 +0100 Do not accumulate underline changes If an element is underlined in mathed by using the text properties dialog, the changes accumulate. So, for example, to change a single underline to a double one, one would need removing the previous underline first. This commit allows using the text properties dialog and simply replace an underline type with another one. However, this works only if the underlined element is not included in some other inset. For example, given "\uline{\text{abc}}", selecting the 'b' and choosing a double underline produces "\uline{\text{a\uuline{b}c}}". But, given "\text{\uline{abc}}", and operating as before produces "\text{\uline{a}\uuline{b}\uline{c}}". --- src/mathed/InsetMathNest.cpp | 98 + 1 files changed, 41 insertions(+), 57 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index d1b033b..944a7d2 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -688,29 +688,11 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) } InsetMathDecoration const * d = asDecorationInset(); + docstring const name = d ? d->name() : docstring(); - if (font.fontInfo().underbar() == FONT_OFF && d && d->name() == "uline") { - lyxerr << "Remove uline" << endl; - } - if (font.fontInfo().uuline() == FONT_OFF && d && d->name() == "uuline") { - lyxerr << "Remove uuline" << endl; - } - if (font.fontInfo().uwave() == FONT_OFF && d && d->name() == "uwave") { - lyxerr << "Remove uwave" << endl; - } - - switch(font.fontInfo().underbar()) { - case FONT_ON: - if (!d || d->name() != "uline") - im = from_ascii("uline"); - break; - case FONT_OFF: - case FONT_TOGGLE: - case FONT_INHERIT: - case FONT_IGNORE: - break; - } - if (!im.empty()) { + if ((font.fontInfo().underbar() == FONT_OFF && name == "uline") || + (font.fontInfo().uuline() == FONT_OFF && name == "uuline") || + (font.fontInfo().uwave() == FONT_OFF && name == "uwave")) { if (include_previous_change) { Cursor oldcur = cur; cur.backwardInset(); @@ -718,46 +700,48 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) cur = oldcur; cur.setSelection(); } - handleNest(cur, createInsetMath(im, cur.buffer())); - im.clear(); - include_previous_change = true; - } - - switch(font.fontInfo().uuline()) { - case FONT_ON: - if (!d || d->name() != "uuline") - im = from_ascii("uuline"); - break; - case FONT_OFF: - case FONT_TOGGLE: - case FONT_INHERIT: - case FONT_IGNORE: - break; - } - if (!im.empty()) { - if (include_previous_change) { - Cursor oldcur = cur; - cur.backwardInset(); - cur.resetAnchor(); - cur = oldcur; - cur.setSelection(); + docstring const beg = '\\' + name + '{'; + docstring const end = from_ascii("}"); + docstring const sel2 = cur.selectionAsString(false); + cap::cutSelection(cur, false); + cur.pos() = 0; + cur.setSelection(); + docstring const sel1 = cur.selectionAsString(false); + cur.pos() = cur.lastpos(); + cur.setSelection(); + docstring const sel3 = cur.selectionAsString(false); + cur.mathForward(false); + cur.setSelection(); + cap::cutSelection(cur, false); + MathData ar; + if (!sel1.empty()) { + mathed_parse_cell(ar, beg + sel1 + end); + cur.insert(ar); } - handleNest(cur, createInsetMath(im, cur.buffer())); - im.clear(); - include_previous_change = true; + cur.resetAnchor(); + mathed_parse_cell(ar, sel2); + cur.insert(ar); + if (!sel3.empty()) { +
[LyX/master] Amend 58103cf2
commit 039de52ad94f47dc86c5a02cc1d7d8bcf991cc99 Author: Enrico Forestieri Date: Wed Nov 8 23:59:43 2023 +0100 Amend 58103cf2 The \underbar macro is a text mode macro that can also be used in math mode. However, when inserting it in mathed, LyX helpfully wraps it in a \text inset. One can dissolve such text inset and the macro would appear in math mode without any problem. But the output routine thinks that the user is shooting itself in the foot and tries to protect him by wrapping \underbar in the \lyxmathsym macro, whose definition is normally added to the preamble when an unicode character is used in math mode. Of course, this is not the case for \underbar and a compile error arises. The easier solution is to simply add lyxmathsym as a requirement for \underbar in lib/symbols, but this means that the definition of \lyxmathsym would be added even when not necessary (because in the validation routine we miss the info about the current mode). The correct solution is acknowledging the dual nature of \underbar as a text-mode macro that can also be used in math mode. Luckily the correct solution is almost as easy as the easier one and is what is done in this commit. --- lib/symbols|2 +- src/mathed/InsetMathDecoration.cpp |3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/symbols b/lib/symbols index f1fa587..aac3ee3 100644 --- a/lib/symbols +++ b/lib/symbols @@ -58,7 +58,7 @@ overlinedecoration none overrightarrow decoration none tilde decoration none uline decoration none ulem -underbardecoration none +underbardecoration everymode underbrace decoration none underleftarrow decoration none amsmath underleftrightarrow decoration none amsmath diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index 614904c..960b6b7 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -182,7 +182,8 @@ void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const void InsetMathDecoration::write(TeXMathStream & os) const { bool needs_mathmode = currentMode() == MATH_MODE; - bool textmode_macro = currentMode() == TEXT_MODE; + bool textmode_macro = currentMode() == TEXT_MODE + && key_->extra != "everymode"; MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro); if (os.fragile() && protect()) os << "\\protect"; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 58103cf2
commit ee19d675240ccc4eefd8a714fa17b80d428a59f2 Author: Enrico Forestieri Date: Fri Nov 17 19:03:46 2023 +0100 Amend 58103cf2 - Do not clear the initial selection to allow consecutive changes (this is in line with the behavior in texted) - Make the color changes last so that the underline is the right color - Allow to operate on selections that span multiple cells in a grid - Use \boldsymbol instead of \mathbf to make everything bold --- src/mathed/InsetMathNest.cpp | 135 - 1 files changed, 92 insertions(+), 43 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 944a7d2..901cc36 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -511,17 +511,15 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) { - bool include_previous_change = false; cur.recordUndoSelection(); + bool include_previous_change = false; + bool selection = cur.selection(); + DocIterator sel_begin = cur.selectionBegin(); + DocIterator sel_end = cur.selectionEnd(); + bool multiple_cells = sel_begin.idx() != sel_end.idx(); Font font; bool b; font.fromString(to_utf8(arg), b); - if (font.fontInfo().color() != Color_inherit && - font.fontInfo().color() != Color_ignore) { - handleNest(cur, MathAtom(new InsetMathColor(buffer_, true, font.fontInfo().color(; - include_previous_change = true; - } - docstring im; InsetMathFont const * f = asFontInset(); @@ -559,13 +557,6 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) break; } if (!im.empty()) { - if (include_previous_change) { - Cursor oldcur = cur; - cur.backwardInset(); - cur.resetAnchor(); - cur = oldcur; - cur.setSelection(); - } handleNest(cur, createInsetMath(im, cur.buffer())); im.clear(); include_previous_change = true; @@ -580,18 +571,22 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) case BOLD_SERIES: if (!f || (f->name() != "textbf" && f->name() != "mathbf")) im = currentMode() != MATH_MODE ? from_ascii("textbf") - : from_ascii("mathbf"); + : from_ascii("boldsymbol"); break; case INHERIT_SERIES: case IGNORE_SERIES: break; } if (!im.empty()) { - if (include_previous_change) { - Cursor oldcur = cur; - cur.backwardInset(); + if (multiple_cells) { + cur.setCursor(sel_begin); + cur.idx() = 0; + cur.pos() = 0; cur.resetAnchor(); - cur = oldcur; + cur.setCursor(sel_end); + cur.pos() = cur.lastpos(); + cur.setSelection(); + } else if (include_previous_change && selection) { cur.setSelection(); } handleNest(cur, createInsetMath(im, cur.buffer())); @@ -613,23 +608,27 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) case SLANTED_SHAPE: if (!f || f->name() != "textsl") im = currentMode() != MATH_MODE ? from_ascii("textsl") - : from_ascii("error"); + : docstring(); break; case SMALLCAPS_SHAPE: if (!f || f->name() != "textsc") im = currentMode() != MATH_MODE ? from_ascii("textsc") - : from_ascii("error"); + : docstring(); break; case INHERIT_SHAPE: case IGNORE_SHAPE: break; } - if (!im.empty() && im != "error") { - if (include_previous_change) { - Cursor oldcur = cur; - cur.backwardInset(); + if (!im.empty()) { + if (multiple_cells) { + cur.setCursor(sel_begin); + cur.idx() = 0; +
[LyX/master] Document 58103cf2
commit dc8d2d554f3c47c753c088b645902c831c66c64e Author: Enrico Forestieri Date: Fri Nov 17 19:30:10 2023 +0100 Document 58103cf2 --- lib/RELEASE-NOTES |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES index bed84af..151e256 100644 --- a/lib/RELEASE-NOTES +++ b/lib/RELEASE-NOTES @@ -56,6 +56,10 @@ * Dark mode on Windows is possible now by choosing "fusion" user interface style in the user interface preferences dialog, your system style has to be set to dark. +* One can now use the Text Properties dialog in mathed to not only change + colors but also other text properties, except strikethrough and language + settings. + !!Documents compilation process and images conversion -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Change the way a filepath is displayed
commit 24cc72266e62e2d9381d439091cfc9994825afe3 Author: Enrico Forestieri Date: Fri Dec 29 19:20:25 2023 +0100 Change the way a filepath is displayed Instead of displaying the complete path, display the file name first and then the path enclosed in parenthesis. In this way files with same name but different path can still be distinguished and, at the same time, files with different names but same path are more easily spotted in case the complete path is truncated by file managers. --- src/support/FileName.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 7fbd2f4..864f387 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -748,7 +748,8 @@ docstring const FileName::absoluteFilePath() const docstring FileName::displayName(int threshold) const { - return makeDisplayPath(absFileName(), threshold); + return from_utf8(onlyFileName()) + " (" + + makeDisplayPath(onlyPath().absFileName(), threshold) + ")"; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Amend 7441172d
commit 9ebc7d95121091e726d52e2c52a1a0032fe9585b Author: Udi-Fogiel Date: Fri Dec 29 20:10:50 2023 +0100 Amend 7441172d colswitch was checking for oldstyle instead of normalcolor to see if we need \normalcolor, which lead to appearence of \color{none} in some cases, but "none" is not a known color. --- src/mathed/InsetMathColor.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp index e3be8ff..549ff37 100644 --- a/src/mathed/InsetMathColor.cpp +++ b/src/mathed/InsetMathColor.cpp @@ -111,9 +111,9 @@ void InsetMathColor::write(TeXMathStream & os) const bool adjchk = os.latex() && !os.inMathClass() && (normalcolor(color_) || oldstyle_); bool adjust_front = frontclass != "mathord" && adjchk; bool adjust_back = backclass != "mathord" && adjchk; - docstring const colswitch = - oldstyle_ ? from_ascii("{\\color{") + color_ + from_ascii("}") - : from_ascii("{\\normalcolor "); + docstring const colswitch = normalcolor(color_) + ? from_ascii("{\\normalcolor ") + : from_ascii("{\\color{") + color_ + from_ascii("}"); if (adjust_front && adjust_back) { os << '\\' << frontclass << colswitch << cell(0).front() << '}'; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update it.po
commit f5b20679a9f5ad9f9b1277f7bdc268d761c0f96a Author: Enrico Forestieri Date: Mon Jan 1 22:00:29 2024 +0100 Update it.po --- po/it.gmo | Bin 636293 -> 639398 bytes po/it.po | 50 +++--- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 8dc4536..2cf5f86 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index afd3935..6d00459 100644 --- a/po/it.po +++ b/po/it.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2023-11-05 11:07-0500\n" -"PO-Revision-Date: 2023-09-23 17:47+0200\n" +"PO-Revision-Date: 2024-01-01 21:54+0100\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.4\n" +"X-Generator: Poedit 3.4.2\n" "X-Poedit-Basepath: C:/cygwin/usr/local/src/lyx/lyx-devel\n" "X-Poedit-SourceCharset: iso-8859-1\n" @@ -2901,14 +2901,12 @@ msgid "&Extended character table" msgstr "Tavola dei caratteri estesa" #: src/frontends/qt/ui/ListingsUi.ui:334 -#, fuzzy msgid "Language[[Programming]]" -msgstr "Programmazione esperta" +msgstr "Linguaggio" #: src/frontends/qt/ui/ListingsUi.ui:343 -#, fuzzy msgid "Lan&guage[[Programming]]:" -msgstr "Programmazione esperta" +msgstr "Lin&guaggio" #: src/frontends/qt/ui/ListingsUi.ui:353 msgid "Select the programming language" @@ -3059,11 +3057,13 @@ msgstr "" "mostrate qui" #: src/frontends/qt/ui/MarginsUi.ui:38 -#, fuzzy msgid "" "Use the margin settings provided by the document class.Note that if this " "is unchecked, different defaults may be used." -msgstr "Usa le impostazioni dei margini provvisti dalla classe del documento" +msgstr "" +"Utilizza le impostazioni dei margini fornite dalla classe del documento." +"Si noti che se questa opzione è deselezionata, possono essere utilizzati " +"valori predefiniti diversi." #: src/frontends/qt/ui/MarginsUi.ui:41 msgid "&Default margins" @@ -4210,7 +4210,6 @@ msgid "Use s&ingle instance" msgstr "Singo&la istanza" #: src/frontends/qt/ui/PrefDocHandlingUi.ui:197 -#, fuzzy msgid "Whether to place close button on each tab or only one in the top right." msgstr "" "Usa un solo pulsante di chiusura in alto a destra invece che un pulsante per " @@ -5128,15 +5127,16 @@ msgid "&User interface file:" msgstr "File interfaccia &utente:" #: src/frontends/qt/ui/PrefUi.ui:88 -#, fuzzy msgid "User interface &style:" -msgstr "File interfaccia &utente:" +msgstr "&Stile interfaccia utente:" #: src/frontends/qt/ui/PrefUi.ui:98 msgid "" "You can set a custom style here. Note that only certain styles may support " "dark mode, e.g. fusion on Windows." msgstr "" +"Qui si può impostare uno stile personalizzato. Tenere presente che solo " +"alcuni stili supportano la modalità scura, ad es. fusion su Windows." #: src/frontends/qt/ui/PrefUi.ui:126 msgid "Context Help" @@ -29266,9 +29266,8 @@ msgid "selection" msgstr "Selezione" #: src/Color.cpp:267 -#, fuzzy msgid "selected math" -msgstr "Testo selezionato" +msgstr "Matematica (selezione)" #: src/Color.cpp:268 msgid "selected text" @@ -1,14 +0,13 @@ msgid "Unapplied changes" msgstr "Modifiche non salvate" #: src/frontends/qt/GuiDocument.cpp:1861 -#, fuzzy msgid "" "Some changes in the document were not yet applied.\n" "Do you want to apply them before closing or dismiss the changes?" msgstr "" -"Alcune modifiche alle impostazioni del documento precedente non erano ancora " -"state applicate.\n" -"Volete tornare indietro ed applicarle?" +"Alcune modifiche alle impostazioni documento non sono state ancora " +"applicate.\n" +"Vuoi applicarle prima di chiudere o ignorarle?" #: src/frontends/qt/GuiDocument.cpp:1863 src/frontends/qt/GuiDocument.cpp:3102 #: src/frontends/qt/GuiDocument.cpp:3403 src/frontends/qt/GuiDocument.cpp:5038 @@ -33346,24 +33344,21 @@ msgid "&Apply" msgstr "&Applica" #: src/frontends/qt/GuiDocument.cpp:1863 src/frontends/qt/GuiDocument.cpp:1889 -#, fuzzy msgid
[LyX/master] Use std::call_once only if it is actually available
commit 41e409f8f7f437ff958b35073d5e2c3f0c90dd87 Author: Enrico Forestieri Date: Sun Aug 7 04:58:41 2016 +0200 Use std::call_once only if it is actually available --- config/lyxinclude.m4 | 28 src/graphics/PreviewLoader.cpp | 12 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 36e0885..7bddfb0 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -247,6 +247,33 @@ AC_DEFUN([LYX_CXX_USE_REGEX], ]) +dnl Usage: LYX_CXX_USE_CALL_ONCE +dnl check whether we can use std::call_once and set the +dnl LYX_USE_STD_CALL_ONCE macro and conditional accordingly. +AC_DEFUN([LYX_CXX_USE_CALL_ONCE], +[AC_MSG_CHECKING([for std::call_once availability]) + save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" + save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS" + AC_TRY_LINK( + [ + #include + static std::once_flag flag; + ], [ + std::call_once(flag, [](){ return; }); + ], [lyx_std_call_once=yes], [lyx_std_call_once=no]) + CXXFLAGS=$save_CXXFLAGS + CPPFLAGS=$save_CPPFLAGS + AC_MSG_RESULT([$lyx_std_call_once]) + + if test $lyx_std_call_once = yes ; then + AC_DEFINE([LYX_USE_STD_CALL_ONCE], 1, [define to 1 if std::call_once is supported by the compiler]) + fi + AM_CONDITIONAL([LYX_USE_STD_CALL_ONCE], test $lyx_std_call_once = yes) +]) + + dnl Usage: LYX_LIB_STDCXX: set lyx_cv_lib_stdcxx to yes if the STL library is libstdc++. AC_DEFUN([LYX_LIB_STDCXX], [AC_CACHE_CHECK([whether STL is libstdc++], @@ -284,6 +311,7 @@ LYX_CXX_CXX11_FLAGS LYX_LIB_STDCXX LYX_LIB_STDCXX_CXX11_ABI LYX_CXX_USE_REGEX +LYX_CXX_USE_CALL_ONCE AC_LANG_POP(C++) if test $lyx_cv_lib_stdcxx = "yes" ; then diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index f8c1d7e..88f49b0 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -93,12 +93,24 @@ lyx::Converter const * setConverter(string const & from) } // Show the error only once +#ifdef LYX_USE_STD_CALL_ONCE + // This is thread-safe. static once_flag flag; call_once(flag, [&](){ LYXERR0("PreviewLoader::startLoading()\n" << "No converter from \"" << from << "\" format has been defined."); }); +#else + // This is not thread-safe. + static bool first = true; + if (first) { + first = false; + LYXERR0("PreviewLoader::startLoading()\n" + << "No converter from \"" << from + << "\" format has been defined."); + } +#endif return 0; }
[LyX/master] Correct comment
commit 7113fb669dcd193295308c44ee2213aa437e38b2 Author: Enrico Forestieri Date: Sat Aug 13 17:43:03 2016 +0200 Correct comment According to C++11 rules, static locals are thread safe for the first-time initialization. See also: http://stackoverflow.com/questions/12302057/c11-safe-double-checked-locking-for-lazy-initialization-possible --- src/graphics/PreviewLoader.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 88f49b0..f3bf437 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -102,7 +102,7 @@ lyx::Converter const * setConverter(string const & from) << "\" format has been defined."); }); #else - // This is not thread-safe. + // This is also thread-safe according to §6.7.4 of the C++11 standard. static bool first = true; if (first) { first = false;
[LyX/master] Adapt code to comment
commit f323a64fc34b83268b769fe549d1bc5801dd19b3 Author: Enrico Forestieri Date: Mon Aug 15 03:22:01 2016 +0200 Adapt code to comment --- src/graphics/PreviewLoader.cpp | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index f3bf437..e9b1d47 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -103,13 +103,11 @@ lyx::Converter const * setConverter(string const & from) }); #else // This is also thread-safe according to §6.7.4 of the C++11 standard. - static bool first = true; - if (first) { - first = false; - LYXERR0("PreviewLoader::startLoading()\n" - << "No converter from \"" << from - << "\" format has been defined."); - } + static bool once = ([&]{ + LYXERR0("PreviewLoader::startLoading()\n" + << "No converter from \"" << from + << "\" format has been defined."); + } (), true); #endif return 0; }
[LyX/master] Add verbose option
commit 2a371bb4b3235462ea6632d31d50ee447933bef8 Author: Enrico Forestieri Date: Wed Aug 17 22:32:14 2016 +0200 Add verbose option Using the option -v (--verbose) all spawned commands are print on the terminal. Note that this was done by default on previous versions. --- lyx.1in |3 +++ src/LyX.cpp | 17 + src/LyX.h |1 + src/client/client.cpp |3 +++ src/frontends/qt4/GuiProgressView.cpp |4 src/support/Systemcall.cpp|6 +- src/support/filetools.cpp |6 ++ src/tex2lyx/dummy_impl.cpp|7 +++ 8 files changed, 46 insertions(+), 1 deletions(-) diff --git a/lyx.1in b/lyx.1in index 8f81660..ed1be04 100644 --- a/lyx.1in +++ b/lyx.1in @@ -94,6 +94,9 @@ by using the lyxpipe, ask an already running instance of LyX to open the documents passed as arguments and then exit. If the lyxpipe is not set up or is not working, a new instance is created and execution continues normally. .TP +\fB \-v [\-\-verbose]\fP +print on terminal all spawned external commands. +.TP .BI \-batch causes LyX to run the given commands without opening a GUI window. Thus, something like: diff --git a/src/LyX.cpp b/src/LyX.cpp index a732c7e..fec8281 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -92,6 +92,12 @@ namespace os = support::os; bool use_gui = true; +// Report on the terminal about spawned commands. The default is false +// and can be changed with the option -v (--verbose). + +bool verbose = false; + + // We default to open documents in an already running instance, provided that // the lyxpipe has been setup. This can be overridden either on the command // line or through preference settings. @@ -1161,6 +1167,8 @@ int parse_help(string const &, string const &, string &) "\t-r [--remote]\n" " open documents in an already running instance\n" " (a working lyxpipe is needed)\n" + "\t-v [--verbose]\n" + " report on terminal about spawned commands.\n" "\t-batchexecute commands without launching GUI and exit.\n" "\t-version summarize version and build info\n" "Check the LyX man page for more details.")) << endl; @@ -1295,6 +1303,13 @@ int parse_remote(string const &, string const &, string &) } +int parse_verbose(string const &, string const &, string &) +{ + verbose = true; + return 0; +} + + int parse_force(string const & arg, string const &, string &) { if (arg == "all") { @@ -1342,6 +1357,8 @@ void LyX::easyParse(int & argc, char * argv[]) cmdmap["--no-remote"] = parse_noremote; cmdmap["-r"] = parse_remote; cmdmap["--remote"] = parse_remote; + cmdmap["-v"] = parse_verbose; + cmdmap["--verbose"] = parse_verbose; for (int i = 1; i < argc; ++i) { map::const_iterator it diff --git a/src/LyX.h b/src/LyX.h index a19b523..4b9c201 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -51,6 +51,7 @@ enum OverwriteFiles { }; extern bool use_gui; +extern bool verbose; extern RunMode run_mode; extern OverwriteFiles force_overwrite; diff --git a/src/client/client.cpp b/src/client/client.cpp index a950f83..023e73e 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -66,6 +66,9 @@ using namespace lyx::support; namespace lyx { +// Dummy verbose support +bool verbose = false; + // Dummy LyXRC support struct LyXRC { string icon_set; diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index 3a8f075..166eed7 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -195,6 +195,10 @@ void GuiProgressView::clearText() void GuiProgressView::appendLyXErrText(QString const & text) { + // Skip verbose messages meant for the terminal + if (text.startsWith("\nRunning:")) + return; + widget_->outTE->moveCursor(QTextCursor::End); widget_->outTE->insertPlainText(text); widget_->outTE->ensureCursorVisible(); diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp index 5dd4a94..cc2c381 100644 --- a/src/support/Systemcall.cpp +++ b/src/support/Systemcall.cpp @@ -23,6 +23,7 @@ #include "support/os.h" #include "support/ProgressInterface.h" +#include "LyX.h" #include "LyXRC.h" #include @@ -239,7 +240,10 @@ int Systemcall::startscript(Starttype how, string const & what,
[LyX/master] Fix exit code from runCommand on Windows
commit fb46b3a1ee642b66b9712c6f376f543c47a2695e Author: Enrico Forestieri Date: Wed Aug 17 22:58:13 2016 +0200 Fix exit code from runCommand on Windows On Windows, runCommand has never returned the exit code of the spawned process but the result of correctly closing the input handle. Fixes #10327 --- src/support/filetools.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index fcb95fa..12457cb 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1071,10 +1071,14 @@ cmd_ret const runCommand(string const & cmd) #if defined (_WIN32) WaitForSingleObject(process.hProcess, INFINITE); + DWORD pret; + if (!GetExitCodeProcess(process.hProcess, &pret)) + pret = -1; if (!infile.empty()) CloseHandle(startup.hStdInput); CloseHandle(process.hProcess); - int const pret = fclose(inf); + if (fclose(inf) != 0) + pret = -1; #elif defined (HAVE_PCLOSE) int const pret = pclose(inf); #elif defined (HAVE__PCLOSE)
[LyX/master] Use only one file for dummy implementations
commit 589f49ff366f88e3f3be9424397d9d99ebf44dfe Author: Enrico Forestieri Date: Sat Aug 20 00:41:04 2016 +0200 Use only one file for dummy implementations --- src/Makefile.am | 16 src/support/tests/dummy_functions.cpp | 20 +-- src/tests/CMakeLists.txt |8 ++-- src/tests/dummy_functions.cpp | 61 - 4 files changed, 28 insertions(+), 77 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 02f0781..dd51584 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -744,9 +744,9 @@ check_layout_SOURCES = \ ModuleList.cpp \ Spacing.cpp \ TextClass.cpp \ + support/tests/dummy_functions.cpp \ tests/check_layout.cpp \ - tests/boost.cpp \ - tests/dummy_functions.cpp + tests/boost.cpp check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS) check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ @@ -757,9 +757,9 @@ check_ExternalTransforms_SOURCES = \ insets/ExternalTransforms.cpp \ Length.cpp \ lengthcommon.cpp \ + support/tests/dummy_functions.cpp \ tests/check_ExternalTransforms.cpp \ - tests/boost.cpp \ - tests/dummy_functions.cpp + tests/boost.cpp check_Length_CPPFLAGS = $(AM_CPPFLAGS) check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ @@ -768,17 +768,17 @@ check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_Length_SOURCES = \ Length.cpp \ lengthcommon.cpp \ + support/tests/dummy_functions.cpp \ tests/check_Length.cpp \ - tests/boost.cpp \ - tests/dummy_functions.cpp + tests/boost.cpp check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS) check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ListingsCaption_SOURCES = \ + support/tests/dummy_functions.cpp \ tests/check_ListingsCaption.cpp \ - tests/boost.cpp \ - tests/dummy_functions.cpp + tests/boost.cpp .PHONY: alltests alltests-recursive updatetests diff --git a/src/support/tests/dummy_functions.cpp b/src/support/tests/dummy_functions.cpp index 6b10660..63ff0c0 100644 --- a/src/support/tests/dummy_functions.cpp +++ b/src/support/tests/dummy_functions.cpp @@ -1,10 +1,13 @@ #include -#include "../Messages.h" +#include "support/Messages.h" using namespace std; namespace lyx { + // Dummy verbose support + bool verbose = false; + // Dummy LyXRC support class LyXRC { string icon_set; } lyxrc; @@ -34,11 +37,20 @@ namespace lyx { { return string(); } + // - // Dummy verbose support + // Dummy FontMetrics (needed by Length) // + namespace frontend { + class FontMetrics { + int em() const { return 0; }; + }; + } - bool verbose = false; - + class FontInfo; + frontend::FontMetrics const & theFontMetrics(FontInfo const &) { + static frontend::FontMetrics dummy; + return dummy; + } } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index af420d3..0bd05b4 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -8,7 +8,7 @@ set(check_layout_SOURCES) foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp - tests/boost.cpp tests/dummy_functions.cpp) + tests/boost.cpp support/tests/dummy_functions.cpp) list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}") endforeach() @@ -53,7 +53,7 @@ endforeach() set(check_ExternalTransforms_SOURCES) foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp - tests/boost.cpp tests/dummy_functions.cpp) + tests/boost.cpp support/tests/dummy_functions.cpp) list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f}) endforeach() @@ -76,7 +76,7 @@ add_test(NAME "check_ExternalTransforms" add_dependencies(lyx_run_tests check_ExternalTransforms) set(check_Length_SOURCES) -foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp tests/dummy_functions.cpp) +foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp support/tests/dummy_functions.cpp) list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f}) endforeach() add_executable(check_Length ${check_Length_SOURCES}) @@ -98,7 +98,7 @@ add_dependencies(lyx_run_tests check_Length) include_directories(${TOP_SRC_DIR}/src/tests) set(
[LyX/master] Quote filenames used for forward-search with SumatraPDF
commit 6adf079796b7bee280233742878c0754979c6d24 Author: Enrico Forestieri Date: Sun Aug 21 23:33:01 2016 +0200 Quote filenames used for forward-search with SumatraPDF Single quotes are special to our parser and must be either escaped or quoted if they are part of a filename, otherwise they are stripped out. See #10342. --- src/frontends/qt4/GuiPrefs.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 26d0c28..996be49 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -420,7 +420,7 @@ PrefOutput::PrefOutput(GuiPreferences * form) dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -i %{page+1} $$o\""); pdfCB->addItem(""); pdfCB->addItem("CMCDDE SUMATRA control [ForwardSearch(\\\"$$o\\\",\\\"$$t\\\",$$n,0,0,1)]"); - pdfCB->addItem("SumatraPDF -reuse-instance $$o -forward-search $$t $$n"); + pdfCB->addItem("SumatraPDF -reuse-instance \"$$o\" -forward-search \"$$t\" $$n"); pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"xpdf -raise -remote $$t.tmp $$o %{page+1}\""); pdfCB->addItem("okular --unique \"$$o#src:$$n $$f\""); pdfCB->addItem("qpdfview --unique \"$$o#src:$$f:$$n:0\"");
[LyX/2.2.x] If available, use qtchooser to select correct Qt tools
commit 874bbe216608e3d4db4ae8692a82d1525d0f6951 Author: Enrico Forestieri Date: Mon Aug 29 22:35:09 2016 +0200 If available, use qtchooser to select correct Qt tools When the Qt directory is specified by --with-qt-dir, the tools are only searched for in the corresponding bin subdir and their full path is retained, so that it is not necessary modifying the PATH and PKG_CONFIG_PATH environment variables to select a custom Qt version. Otherwise, if qtchooser is detected early in the PATH, the generic names are attempted with proper arguments to select the desired Qt version (e.g., "moc -qt=qt5" if --enable-qt5 is specified). Failing all of the above, the generic names with and without proper suffixes (either -qt4 or -qt5) are checked in the PATH. Eventually, a check is performed and a warning is issued if the selected tools do not match the chosen Qt libraries. --- config/qt4.m4 | 11 ++- status.22x|1 + 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/config/qt4.m4 b/config/qt4.m4 index 33029b9..9366371 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -71,11 +71,20 @@ AC_DEFUN([QT_FIND_TOOL], if test "x$USE_QT5" != "xno" ; then qt_ext=qt5 fi + if test -n "$qt_cv_bin" ; then AC_PATH_PROGS($1, [$2], [], $qt_cv_bin) + elif qtchooser -l 2>/dev/null | grep -q ^$qt_ext\$ >/dev/null ; then + AC_PATH_PROG(qtc_path, qtchooser, [], [$PATH]) + AC_PATH_PROG($2_path, $2, [], [$PATH]) + qtc_path=`dirname "$qtc_path"` + $2_path=`dirname "$$2_path"` + if test "$qtc_path" = "$$2_path" ; then + AC_CHECK_PROG($1, $2, [$2 -qt=$qt_ext],, [$PATH]) + fi fi if test -z "$$1"; then - AC_PATH_PROGS($1, [$2-$qt_ext $2],[],$PATH) + AC_CHECK_PROGS($1, [$2-$qt_ext $2],[],$PATH) fi if test -z "$$1"; then AC_MSG_ERROR([cannot find $2 binary.]) diff --git a/status.22x b/status.22x index b27f6d7..327f979 100644 --- a/status.22x +++ b/status.22x @@ -40,6 +40,7 @@ What's new * BUILD/INSTALLATION +- If available, use qtchooser to select correct Qt tools when configuring.
[LyX/master] Ensure proper mode in mathed
commit 324651899e605870b410fa9dcad78d4c8dc4fd0f Author: Enrico Forestieri Date: Sat Sep 10 02:07:47 2016 +0200 Ensure proper mode in mathed A math-mode command entered in a text-mode environment is wrapped in an ensuremath inset, as well as a text-mode command entered in a math-mode environment is wrapped in a text inset. Who doesn't like the extra insets can always dissolve them and rely on the wrapping performed on export. --- src/Cursor.cpp | 17 - 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 8d5c63b..6f1a194 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -47,9 +47,11 @@ #include "mathed/InsetMath.h" #include "mathed/InsetMathBrace.h" +#include "mathed/InsetMathEnsureMath.h" #include "mathed/InsetMathScript.h" #include "mathed/MacroTable.h" #include "mathed/MathData.h" +#include "mathed/MathFactory.h" #include "mathed/MathMacro.h" #include @@ -1447,7 +1449,20 @@ bool Cursor::macroModeClose() else if (atom.nucleus()->nargs() > 0) atom.nucleus()->cell(0).append(selection); - plainInsert(atom); + if (in->currentMode() == Inset::TEXT_MODE + && atom.nucleus()->currentMode() == Inset::MATH_MODE) { + MathAtom at(new InsetMathEnsureMath(buffer())); + at.nucleus()->cell(0).push_back(atom); + niceInsert(at); + posForward(); + } else if (in->currentMode() == Inset::MATH_MODE + && atom.nucleus()->currentMode() == Inset::TEXT_MODE) { + MathAtom at = createInsetMath("text", buffer()); + at.nucleus()->cell(0).push_back(atom); + niceInsert(at); + posForward(); + } else + plainInsert(atom); // finally put the macro argument behind, if needed if (macroArg) {
[LyX/master] Avoid duplicating mode changing commands
commit 5cdbaf51ee73e23b9c0dfd6e8a9aa5fea1d798de Author: Enrico Forestieri Date: Sat Sep 10 02:39:57 2016 +0200 Avoid duplicating mode changing commands --- src/Cursor.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 6f1a194..4e63734 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1450,13 +1450,15 @@ bool Cursor::macroModeClose() atom.nucleus()->cell(0).append(selection); if (in->currentMode() == Inset::TEXT_MODE - && atom.nucleus()->currentMode() == Inset::MATH_MODE) { + && atom.nucleus()->currentMode() == Inset::MATH_MODE + && name != from_ascii("ensuremath")) { MathAtom at(new InsetMathEnsureMath(buffer())); at.nucleus()->cell(0).push_back(atom); niceInsert(at); posForward(); } else if (in->currentMode() == Inset::MATH_MODE - && atom.nucleus()->currentMode() == Inset::TEXT_MODE) { + && atom.nucleus()->currentMode() == Inset::TEXT_MODE + && name != from_ascii("text")) { MathAtom at = createInsetMath("text", buffer()); at.nucleus()->cell(0).push_back(atom); niceInsert(at);
[LyX/master] Fix bug #9616
commit cb7094696095236b9a7133f41901e90aee767544 Author: Enrico Forestieri Date: Sat Sep 10 13:36:45 2016 +0200 Fix bug #9616 --- src/Encoding.cpp | 10 ++ src/Encoding.h |6 ++ src/mathed/InsetMathNest.cpp |2 +- 3 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 73edc84..acb91f6 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -601,6 +601,16 @@ bool Encodings::isMathAlpha(char_type c) } +bool Encodings::isUnicodeTextOnly(char_type c) +{ + if (isASCII(c) || isMathAlpha(c)) + return false; + + CharInfoMap::const_iterator const it = unicodesymbols.find(c); + return it == unicodesymbols.end() || it->second.mathcommand().empty(); +} + + Encoding const * Encodings::fromLyXName(string const & name, bool allowUnsafe) const { diff --git a/src/Encoding.h b/src/Encoding.h index 5e289ca..0f6e8ff 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -287,6 +287,12 @@ public: */ static bool isMathAlpha(char_type c); /** +* Do we have to wrap in \text this character when in mathmode? +* This is true if \p c is not ascii and the "mathalpha" flag is not +* set and a mathcommand is not defined in the unicodesymbols file. +*/ + static bool isUnicodeTextOnly(char_type c); + /** * Register \p c as a mathmode command. */ static void addMathCmd(char_type c) { mathcmd.insert(c); } diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 223e31a..4216145 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1856,7 +1856,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) cur.niceInsert(createInsetMath("sim", buf)); return true; } - if (currentMode() == InsetMath::MATH_MODE && !isAsciiOrMathAlpha(c)) { + if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) { MathAtom at = createInsetMath("text", buf); at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c))); cur.niceInsert(at);
[LyX/master] Fix display and export of some latex macros
commit 2aa930bbe8f2bf07f665b5cda70842748add271a Author: Enrico Forestieri Date: Sat Sep 10 18:32:44 2016 +0200 Fix display and export of some latex macros Fixes #9742. --- lib/symbols| 44 src/BufferParams.cpp |1 + src/LaTeXFeatures.cpp | 20 ++ src/LaTeXFeatures.h|2 + src/mathed/InsetMathFont.cpp | 18 src/mathed/InsetMathFont.h |2 + src/mathed/InsetMathSpace.cpp |4 ++- src/mathed/InsetMathSymbol.cpp |2 + src/mathed/MacroTable.h|2 + src/mathed/MathFactory.cpp | 36 src/mathed/MathMacro.cpp | 11 +- src/mathed/MathStream.h| 43 ++ 12 files changed, 138 insertions(+), 47 deletions(-) diff --git a/lib/symbols b/lib/symbols index 2d13250..ba2b6d3 100644 --- a/lib/symbols +++ b/lib/symbols @@ -667,18 +667,18 @@ lyxleftmsa 76 0 mathord ← male wasy 26 0 x♂ female wasy 25 0 x♀ -currency wasy 27 0 textmode ¤ wasysym # works in text mode only (produces \oe in math mode) -phone wasy 7 0 textmode ☎ wasysym # works in text mode only (produces \Upsilon in math mode) -recorder wasy 6 0 textmode ⌕ wasysym # works in text mode only (produces \Sigma in math mode) -clock wasy 28 0 textmode &clock; wasysym # works in text mode only (produces \o in math mode) -lightning wasy 18 0 textmode ☇ wasysym # works in text mode only (produces ` in math mode) +currency wasy 27 0 textmode ¤ wasysym,amstext,lyxmathsym # works in text mode only (produces \oe in math mode) +phone wasy 7 0 textmode ☎ wasysym,amstext,lyxmathsym # works in text mode only (produces \Upsilon in math mode) +recorder wasy 6 0 textmode ⌕ wasysym,amstext,lyxmathsym # works in text mode only (produces \Sigma in math mode) +clock wasy 28 0 textmode &clock; wasysym,amstext,lyxmathsym # works in text mode only (produces \o in math mode) +lightning wasy 18 0 textmode ☇ wasysym,amstext,lyxmathsym # works in text mode only (produces ` in math mode) # FIXME Display is wrong (bug 8493): qt does not display characters at the \t position (0x09) -pointerwasy 9 0 textmode xwasysym # works in text mode only (produces \Psi in math mode) -RIGHTarrow wasy 17 0 textmode ▶ wasysym # works in text mode only (produces \jmath in math mode) -LEFTarrow wasy 16 0 textmode ◀ wasysym # works in text mode only (produces \imath in math mode) -UParrowwasy 75 0 textmode ▲ wasysym # works in text mode only (produces K in math mode) -DOWNarrow wasy 76 0 textmode ▼ wasysym # works in text mode only (produces L in math mode) -AC wasy 58 0 textmode ∿ wasysym # works in text mode only +pointerwasy 9 0 textmode x wasysym,amstext,lyxmathsym # works in text mode only (produces \Psi in math mode) +RIGHTarrow wasy 17 0 textmode ▶ wasysym,amstext,lyxmathsym # works in text mode only (produces \jmath in math mode) +LEFTarrow wasy 16 0 textmode ◀ wasysym,amstext,lyxmathsym # works in text mode only (produces \imath in math mode) +UParrowwasy 75 0 textmode ▲ wasysym,amstext,lyxmathsym # works in text mode only (produces K in math mode) +DOWNarrow wasy 76 0 textmode ▼ wasysym,amstext,lyxmathsym # works in text mode only (produces L in math mode) +AC wasy 58 0 textmode ∿ wasysym,amstext,lyxmathsym # works in text mode only \def\HF{\approx} wasysym VHFwasy 64 0 x≋ # triple tilde Square wasy 50 0 x□ @@ -770,8 +770,8 @@ sagittariuswasy 99 0 x♐ capricornuswasy 100 0 x♑ aquarius wasy 101 0 x♒ pisces wasy 102 0 x♓ -conjunctionwasy 86 0 textmode ☌ wasysym # works in text mode only (produces V in math mode) -opposition wasy 87 0 textmode ☍ wasysym # works in text mode only (produces W in math mode) +conjunctionwasy 86 0 textmode ☌ wasysym,amstext,lyxmathsym # works in text mode only (produces V in math mode) +opposition wasy 87 0 textmode ☍ wasysym,amstext,lyxmathsym # works in text mode only (produces W in math mode) # APL characters APLstarwasy 69 0 x⍟ APLlog wasy 22 0 xx @@
[LyX/master] Make sure a pointer is valid before using it
commit 615c733844e604cd1e966206eaffa61d14f7bd39 Author: Enrico Forestieri Date: Mon Sep 12 05:15:00 2016 +0200 Make sure a pointer is valid before using it --- src/Cursor.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 4e63734..b3c1edd 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1449,14 +1449,14 @@ bool Cursor::macroModeClose() else if (atom.nucleus()->nargs() > 0) atom.nucleus()->cell(0).append(selection); - if (in->currentMode() == Inset::TEXT_MODE + if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE && name != from_ascii("ensuremath")) { MathAtom at(new InsetMathEnsureMath(buffer())); at.nucleus()->cell(0).push_back(atom); niceInsert(at); posForward(); - } else if (in->currentMode() == Inset::MATH_MODE + } else if (in && in->currentMode() == Inset::MATH_MODE && atom.nucleus()->currentMode() == Inset::TEXT_MODE && name != from_ascii("text")) { MathAtom at = createInsetMath("text", buffer());
[LyX/master] Ensure consistency
commit a24033ff0e49316ba90919f024c561914d55ad47 Author: Enrico Forestieri Date: Mon Sep 12 07:55:38 2016 +0200 Ensure consistency On export, a macro defined in ERT (or not defined at all) is left in the same environment it is entered. So, don't explicitly insert it in an ensuremath environment when it is entered in a textmode one. --- src/Cursor.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index b3c1edd..64d7ad3 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1449,9 +1449,11 @@ bool Cursor::macroModeClose() else if (atom.nucleus()->nargs() > 0) atom.nucleus()->cell(0).append(selection); + bool ert_macro = atomAsMacro && !atomAsMacro->macro(); + if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE - && name != from_ascii("ensuremath")) { + && name != from_ascii("ensuremath") && !ert_macro) { MathAtom at(new InsetMathEnsureMath(buffer())); at.nucleus()->cell(0).push_back(atom); niceInsert(at);
[LyX/2.2.x] Update it.po
commit ca018b237a3685e2cda9b4f654927f8a5981a63f Author: Enrico Forestieri Date: Mon Sep 12 08:18:36 2016 +0200 Update it.po --- po/it.gmo | Bin 484190 -> 486658 bytes po/it.po | 990 +++-- 2 files changed, 438 insertions(+), 552 deletions(-) diff --git a/po/it.gmo b/po/it.gmo index 190e5a5..f8ebcea 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index fd87796..e828a32 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2016-09-11 12:06-0400\n" -"PO-Revision-Date: 2016-07-12 17:42+0200\n" +"PO-Revision-Date: 2016-09-12 08:17+0200\n" "Last-Translator: Enrico Forestieri \n" "Language-Team: italiano \n" "Language: it\n" @@ -41,12 +41,12 @@ msgstr "Compilazione" #: src/frontends/qt4/ui/AboutUi.ui:116 msgid "Release Notes" -msgstr "Note di rilascio" +msgstr "Note di pubblicazione" #: src/frontends/qt4/ui/AboutUi.ui:159 src/frontends/qt4/ui/CompareUi.ui:163 #: src/frontends/qt4/ui/DelimiterUi.ui:286 -#: src/frontends/qt4/ui/ErrorListUi.ui:60 -#: src/frontends/qt4/ui/ExternalUi.ui:620 src/frontends/qt4/ui/IncludeUi.ui:250 +#: src/frontends/qt4/ui/ErrorListUi.ui:60 src/frontends/qt4/ui/ExternalUi.ui:620 +#: src/frontends/qt4/ui/IncludeUi.ui:250 #: src/frontends/qt4/ui/InsetParamsUi.ui:138 src/frontends/qt4/ui/LogUi.ui:88 #: src/frontends/qt4/ui/ParagraphUi.ui:261 src/frontends/qt4/ui/PrefsUi.ui:90 #: src/frontends/qt4/ui/RefUi.ui:343 src/frontends/qt4/ui/SearchUi.ui:203 @@ -156,8 +156,7 @@ msgid "&Options:" msgstr "&Opzioni:" #: src/frontends/qt4/ui/BiblioUi.ui:211 -msgid "" -"Define options such as --min-crossrefs (see the documentation of BibTeX)" +msgid "Define options such as --min-crossrefs (see the documentation of BibTeX)" msgstr "" "Per definire opzioni quali --min-crossrefs (vedere il manuale di BibTeX)." @@ -245,9 +244,9 @@ msgstr "Aggiungi bibliografia all'&indice" #: src/frontends/qt4/ui/CitationUi.ui:511 #: src/frontends/qt4/ui/CompareHistoryUi.ui:183 #: src/frontends/qt4/ui/CompareUi.ui:153 src/frontends/qt4/ui/DocumentUi.ui:67 -#: src/frontends/qt4/ui/ExternalUi.ui:600 -#: src/frontends/qt4/ui/GraphicsUi.ui:711 src/frontends/qt4/ui/IncludeUi.ui:237 -#: src/frontends/qt4/ui/IndexUi.ui:41 src/frontends/qt4/ui/InsetParamsUi.ui:118 +#: src/frontends/qt4/ui/ExternalUi.ui:600 src/frontends/qt4/ui/GraphicsUi.ui:711 +#: src/frontends/qt4/ui/IncludeUi.ui:237 src/frontends/qt4/ui/IndexUi.ui:41 +#: src/frontends/qt4/ui/InsetParamsUi.ui:118 #: src/frontends/qt4/ui/ListingsUi.ui:539 #: src/frontends/qt4/ui/MathMatrixUi.ui:263 src/frontends/qt4/ui/NoteUi.ui:38 #: src/frontends/qt4/ui/ParagraphUi.ui:241 src/frontends/qt4/ui/PhantomUi.ui:38 @@ -255,8 +254,7 @@ msgstr "Aggiungi bibliografia all'&indice" #: src/frontends/qt4/ui/SendtoUi.ui:72 src/frontends/qt4/ui/ShortcutUi.ui:52 #: src/frontends/qt4/ui/SymbolsUi.ui:49 #: src/frontends/qt4/ui/TabularCreateUi.ui:127 -#: src/frontends/qt4/ui/ToggleWarningUi.ui:90 -#: src/frontends/qt4/ui/WrapUi.ui:150 +#: src/frontends/qt4/ui/ToggleWarningUi.ui:90 src/frontends/qt4/ui/WrapUi.ui:150 msgid "&OK" msgstr "&OK" @@ -331,11 +329,11 @@ msgstr "Tipo di casella" #: src/frontends/qt4/ui/BoxUi.ui:91 src/frontends/qt4/ui/HSpaceUi.ui:32 #: src/frontends/qt4/ui/ListingsUi.ui:98 src/frontends/qt4/ui/TabularUi.ui:1199 -#: src/frontends/qt4/ui/TabularUi.ui:1218 -#: src/frontends/qt4/ui/TabularUi.ui:1266 src/frontends/qt4/GuiBox.cpp:425 -#: src/frontends/qt4/GuiBox.cpp:635 src/frontends/qt4/GuiDocument.cpp:120 -#: src/frontends/qt4/GuiGraphics.cpp:582 src/frontends/qt4/GuiMathMatrix.cpp:33 -#: src/frontends/qt4/GuiPrefs.cpp:2186 src/frontends/qt4/GuiPrefs.cpp:2209 +#: src/frontends/qt4/ui/TabularUi.ui:1218 src/frontends/qt4/ui/TabularUi.ui:1266 +#: src/frontends/qt4/GuiBox.cpp:425 src/frontends/qt4/GuiBox.cpp:635 +#: src/frontends/qt4/GuiDocument.cpp:120 src/frontends/qt4/GuiGraphics.cpp:582 +#: src/frontends/qt4/GuiMathMatrix.cpp:33 src/frontends/qt4/GuiPrefs.cpp:2186 +#: src/frontends/qt4/GuiPrefs.cpp:2209 msgid "None" msgstr "Nessuno" @@ -599,15 +597,15 @@ msgstr "Aggiungi &tutti" #: src/frontends/qt4/ui/PrintindexUi.ui:28 src/Buffer.cpp:1379 #: src/Buffer.cpp:4360 src/Buffer.cpp:4424 src/LyXVC.cpp:108 src/LyXVC.cpp:298 #: src/buffer_funcs.cpp:78 src/frontends/qt4/GuiBranches.cpp:219 -#: src/frontends/qt4/GuiClipboard.cpp:247 -#: src/frontends/qt4/GuiDocument.cpp:2150 src/frontends/qt4/GuiParagraph.cpp:69 -#: src/frontends/qt4/GuiParagraph.cpp:161 src/frontends/qt4/GuiPrefs.cpp:3157 -#: src/frontends
[LyX/master] Make sure that math macros are updated at export time.
commit 8f86ee74cddc6d3d9f8eea4d98ad4d4bab842411 Author: Enrico Forestieri Date: Tue Sep 13 07:53:48 2016 +0200 Make sure that math macros are updated at export time. The math macros system is quite complex. Macros are updated during metrics calculation, so a missing update is very likely to cause a crash. This commit tries to assure that they are updated at export time, which also happens when the table of contents is updated. Moreover, in order to circumvent a possible missing update, when a math macro is detected we try to avoid using the sym_ member of the MacroData class, as it may contain bogus values. --- src/BufferView.cpp |8 ++-- src/mathed/MathMacro.cpp |8 +--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 0212b16..dd18b25 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -495,7 +495,9 @@ void BufferView::processUpdateFlags(Update::flags flags) // updateMetrics() does not update paragraph position // This is done at draw() time. So we need a redraw! - buffer_.changed(false); + // We pass true so that metrics are computed for the sake + // of having MacroData updated. + buffer_.changed(true); if (needsFitCursor()) { // The cursor is off screen so ensure it is visible. @@ -2181,7 +2183,9 @@ void BufferView::updateHoveredInset() const // This event (moving without mouse click) is not passed further. // This should be changed if it is further utilized. - buffer_.changed(false); + // We pass true so that metrics are computed for the sake + // of having MacroData updated. + buffer_.changed(true); } } diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 4529cf9..cb853a3 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -614,7 +614,8 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const drawMarkers2(pi, expx, expy); } else { bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX; - bool upshape = d->macro_ && d->macro_->symbol() + bool user_macro = mathedWordList().find(name()) == mathedWordList().end(); + bool upshape = user_macro ? false : d->macro_ && d->macro_->symbol() && d->macro_->symbol()->extra == "textmode"; Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE : pi.base.font.shape()); @@ -929,9 +930,10 @@ bool MathMacro::folded() const void MathMacro::write(WriteStream & os) const { - bool const textmode_macro = d->macro_ && d->macro_->symbol() + bool user_macro = mathedWordList().find(name()) == mathedWordList().end(); + bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol() && d->macro_->symbol()->extra == "textmode"; - bool const needs_mathmode = d->macro_ && (!d->macro_->symbol() + bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol() || d->macro_->symbol()->extra != "textmode"); MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
[LyX/master] Make sure not to use a pointer that may be bogus
commit 8ec91e804a038982d07fc2f88511da8579b9b523 Author: Enrico Forestieri Date: Wed Sep 14 02:27:18 2016 +0200 Make sure not to use a pointer that may be bogus It may happen that mathedWordList is not still updated at load time, so we would still be using a bogus pointer. Better fetching the necessary info from the global macro table. --- src/mathed/MathMacro.cpp | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index cb853a3..5a73742 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -614,9 +614,9 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const drawMarkers2(pi, expx, expy); } else { bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX; - bool user_macro = mathedWordList().find(name()) == mathedWordList().end(); - bool upshape = user_macro ? false : d->macro_ && d->macro_->symbol() - && d->macro_->symbol()->extra == "textmode"; + MacroData const * macro = MacroTable::globalMacros().get(name()); + bool upshape = macro && macro->symbol() + && macro->symbol()->extra == "textmode"; Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE : pi.base.font.shape()); @@ -930,11 +930,11 @@ bool MathMacro::folded() const void MathMacro::write(WriteStream & os) const { - bool user_macro = mathedWordList().find(name()) == mathedWordList().end(); - bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol() - && d->macro_->symbol()->extra == "textmode"; - bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol() - || d->macro_->symbol()->extra != "textmode"); + MacroData const * macro = MacroTable::globalMacros().get(name()); + bool textmode_macro = macro && macro->symbol() + && macro->symbol()->extra == "textmode"; + bool needs_mathmode = macro && (!macro->symbol() + || macro->symbol()->extra != "textmode"); MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
[LyX/master] Partly revert the bits of 8f86ee74 that are not necessary anymore after 8ec91e80
commit 72cf7c8f1f9311720832801af8eaff700333c1b8 Author: Enrico Forestieri Date: Wed Sep 14 02:51:56 2016 +0200 Partly revert the bits of 8f86ee74 that are not necessary anymore after 8ec91e80 --- src/BufferView.cpp |8 ++-- 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index dd18b25..0212b16 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -495,9 +495,7 @@ void BufferView::processUpdateFlags(Update::flags flags) // updateMetrics() does not update paragraph position // This is done at draw() time. So we need a redraw! - // We pass true so that metrics are computed for the sake - // of having MacroData updated. - buffer_.changed(true); + buffer_.changed(false); if (needsFitCursor()) { // The cursor is off screen so ensure it is visible. @@ -2183,9 +2181,7 @@ void BufferView::updateHoveredInset() const // This event (moving without mouse click) is not passed further. // This should be changed if it is further utilized. - // We pass true so that metrics are computed for the sake - // of having MacroData updated. - buffer_.changed(true); + buffer_.changed(false); } }
[LyX/master] Really fix the problem with not updated macros
commit e36a8903d7bf6433056dffcc290c369a37cf6e3a Author: Enrico Forestieri Date: Thu Sep 15 02:39:30 2016 +0200 Really fix the problem with not updated macros Revert to the strategy used at 8f86ee74 but not using mathedWordList because it may be still uninitialized at load time. Instead, use the globalMacros method for getting the same info. There was a thinko at 8ec91e80, because globalMacros always returns null for user defined macros. --- src/BufferView.cpp |8 ++-- src/mathed/MathMacro.cpp | 16 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index fa95d40..fad0154 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -495,7 +495,9 @@ void BufferView::processUpdateFlags(Update::flags flags) // updateMetrics() does not update paragraph position // This is done at draw() time. So we need a redraw! - buffer_.changed(false); + // We pass true so that metrics are computed for the sake + // of having MacroData updated. + buffer_.changed(true); if (needsFitCursor()) { // The cursor is off screen so ensure it is visible. @@ -2165,7 +2167,9 @@ void BufferView::updateHoveredInset() const // This event (moving without mouse click) is not passed further. // This should be changed if it is further utilized. - buffer_.changed(false); + // We pass true so that metrics are computed for the sake + // of having MacroData updated. + buffer_.changed(true); } } diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 5a73742..e1484e8 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -614,9 +614,9 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const drawMarkers2(pi, expx, expy); } else { bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX; - MacroData const * macro = MacroTable::globalMacros().get(name()); - bool upshape = macro && macro->symbol() - && macro->symbol()->extra == "textmode"; + bool user_macro = !MacroTable::globalMacros().get(name()); + bool upshape = user_macro ? false : d->macro_ && d->macro_->symbol() + && d->macro_->symbol()->extra == "textmode"; Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE : pi.base.font.shape()); @@ -930,11 +930,11 @@ bool MathMacro::folded() const void MathMacro::write(WriteStream & os) const { - MacroData const * macro = MacroTable::globalMacros().get(name()); - bool textmode_macro = macro && macro->symbol() - && macro->symbol()->extra == "textmode"; - bool needs_mathmode = macro && (!macro->symbol() - || macro->symbol()->extra != "textmode"); + bool user_macro = !MacroTable::globalMacros().get(name()); + bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol() + && d->macro_->symbol()->extra == "textmode"; + bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol() + || d->macro_->symbol()->extra != "textmode"); MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
[LyX/master] Do not prematurely close \ensuremath or \lyxmathsym on export
commit 1b7dea5c2fa83efc80f056aafc8f5d8b4551daa1 Author: Enrico Forestieri Date: Fri Sep 16 00:32:35 2016 +0200 Do not prematurely close \ensuremath or \lyxmathsym on export --- src/mathed/MathFactory.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 0814167..478d22a 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -387,7 +387,7 @@ bool ensureMath(WriteStream & os, bool needs_mathmode, bool macro, brace = true; } os.textMode(true); - } else if (macro && brace && !textmode_macro) { + } else if (macro && brace && !needs_mathmode && !textmode_macro) { // This is a user defined macro, not a MathMacro, so we // cannot be sure what mode is needed. We leave it in the // same environment it was entered by closing either \lyxmathsym
[LyX/master] Avoid inserting spurious \text insets in mathed
commit 364e8d66927161abec69c597a7022162db9a8af9 Author: Enrico Forestieri Date: Fri Sep 16 00:37:04 2016 +0200 Avoid inserting spurious \text insets in mathed This amends 5cdbaf51. --- src/Cursor.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 64d7ad3..27c9cd6 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1449,6 +1449,11 @@ bool Cursor::macroModeClose() else if (atom.nucleus()->nargs() > 0) atom.nucleus()->cell(0).append(selection); + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it = words.find(name); + bool keep_mathmode = it != words.end() && (it->second.inset == "font" + || it->second.inset == "oldfont" + || it->second.inset == "mbox"); bool ert_macro = atomAsMacro && !atomAsMacro->macro(); if (in && in->currentMode() == Inset::TEXT_MODE @@ -1460,7 +1465,7 @@ bool Cursor::macroModeClose() posForward(); } else if (in && in->currentMode() == Inset::MATH_MODE && atom.nucleus()->currentMode() == Inset::TEXT_MODE - && name != from_ascii("text")) { + && !keep_mathmode) { MathAtom at = createInsetMath("text", buffer()); at.nucleus()->cell(0).push_back(atom); niceInsert(at);
[LyX/master] Correctly distinguish LyX macros from those defined in ERT
commit a26e75cd8adc26105fab175f88d646fd19cbd595 Author: Enrico Forestieri Date: Fri Sep 16 00:43:04 2016 +0200 Correctly distinguish LyX macros from those defined in ERT At this time the MacroData of a macro is still uninitialized, so the macro() method always returns null. --- src/Cursor.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 27c9cd6..6485fc4 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1426,8 +1426,9 @@ bool Cursor::macroModeClose() InsetMathNest * const in = inset().asInsetMath()->asNestInset(); if (in && in->interpretString(*this, s)) return true; - MathAtom atom = buffer()->getMacro(name, *this, false) ? - MathAtom(new MathMacro(buffer(), name)) : createInsetMath(name, buffer()); + bool const ert_macro = !buffer()->getMacro(name, *this, false); + MathAtom atom = ert_macro ? createInsetMath(name, buffer()) + : MathAtom(new MathMacro(buffer(), name)); // try to put argument into macro, if we just inserted a macro bool macroArg = false; @@ -1454,7 +1455,6 @@ bool Cursor::macroModeClose() bool keep_mathmode = it != words.end() && (it->second.inset == "font" || it->second.inset == "oldfont" || it->second.inset == "mbox"); - bool ert_macro = atomAsMacro && !atomAsMacro->macro(); if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE
[LyX/master] Correctly distinguish ERT macros from predefined ones such as \alpha
commit c4aca5705b149511d9311aba8cbb94254a801756 Author: Enrico Forestieri Date: Fri Sep 16 02:15:52 2016 +0200 Correctly distinguish ERT macros from predefined ones such as \alpha --- src/Cursor.cpp |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 6485fc4..72c723b 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1426,9 +1426,9 @@ bool Cursor::macroModeClose() InsetMathNest * const in = inset().asInsetMath()->asNestInset(); if (in && in->interpretString(*this, s)) return true; - bool const ert_macro = !buffer()->getMacro(name, *this, false); - MathAtom atom = ert_macro ? createInsetMath(name, buffer()) - : MathAtom(new MathMacro(buffer(), name)); + bool const user_macro = buffer()->getMacro(name, *this, false); + MathAtom atom = user_macro ? MathAtom(new MathMacro(buffer(), name)) + : createInsetMath(name, buffer()); // try to put argument into macro, if we just inserted a macro bool macroArg = false; @@ -1455,6 +1455,7 @@ bool Cursor::macroModeClose() bool keep_mathmode = it != words.end() && (it->second.inset == "font" || it->second.inset == "oldfont" || it->second.inset == "mbox"); + bool ert_macro = !user_macro && it == words.end(); if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE
[LyX/master] Improve systemlyxdir handling
commit ade098e2896bd9d7d87b3df1a9276661dd3f7c78 Author: Enrico Forestieri Date: Sat Sep 17 22:38:27 2016 +0200 Improve systemlyxdir handling Do not assume that the /systemlyxdir path prefix in \origin refers to the system directory of the running instance, but check through some heuristics what the real system dir is. In this way, a document in the system dir of any other LyX installation is correctly spotted and the \origin tag properly updated. For example, one can use an installed version of lyx to edit a document in the lib/doc dir of a git repo and obtain the same result as when running lyx in place. --- src/BufferParams.cpp | 41 ++--- 1 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index fa95e6a..eff684d 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -305,6 +305,35 @@ SpaceTranslator const & spacetranslator() return translator; } + +bool inSystemDir(FileName const & document_dir, string & system_dir) +{ + // A document is assumed to be in a system LyX directory (not + // necessarily the system directory of the running instance) + // if both "configure.py" and "chkconfig.ltx" are found in + // either document_dir/../ or document_dir/../../. + // If true, the system directory path is returned in system_dir + // with a trailing path separator. + + string const msg = "Checking whether document is in a system dir..."; + + string dir = document_dir.absFileName(); + + for (int i = 0; i < 2; ++i) { + dir = addPath(dir, ".."); + if (!fileSearch(dir, "configure.py").empty() && + !fileSearch(dir, "chkconfig.ltx").empty()) { + LYXERR(Debug::FILES, msg << " yes"); + system_dir = addPath(FileName(dir).realPath(), ""); + return true; + } + } + + LYXERR(Debug::FILES, msg << " no"); + system_dir = string(); + return false; +} + } // anon namespace @@ -683,8 +712,12 @@ string BufferParams::readToken(Lexer & lex, string const & token, origin = lex.getString(); string const sysdirprefix = "/systemlyxdir/"; if (prefixIs(origin, sysdirprefix)) { - origin.replace(0, sysdirprefix.length() - 1, - package().system_support().absFileName()); + string docsys; + if (inSystemDir(filepath, docsys)) + origin.replace(0, sysdirprefix.length() - 1, docsys); + else + origin.replace(0, sysdirprefix.length() - 1, + package().system_support().absFileName()); } } else if (token == "\\begin_preamble") { readPreamble(lex); @@ -1028,8 +1061,10 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const // the document directory (must end with a path separator) // realPath() is used to resolve symlinks, while addPath(..., "") // ensures a trailing path separator. + string docsys; string filepath = addPath(buf->fileName().onlyPath().realPath(), ""); - string const sysdir = addPath(package().system_support().realPath(), ""); + string const sysdir = inSystemDir(FileName(filepath), docsys) ? docsys + : addPath(package().system_support().realPath(), ""); string const relpath = to_utf8(makeRelPath(from_utf8(filepath), from_utf8(sysdir))); if (!prefixIs(relpath, "../") && !FileName::isAbsolute(relpath))
[LyX/master] Document the new behaviour in mathed
commit d0f608d28ebeabadc8308f408f2a67980da8e73c Author: Enrico Forestieri Date: Mon Sep 19 11:57:39 2016 +0200 Document the new behaviour in mathed --- lib/RELEASE-NOTES | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES index c8ce1ba..8ec209e 100644 --- a/lib/RELEASE-NOTES +++ b/lib/RELEASE-NOTES @@ -3,9 +3,15 @@ !!Interface changes -LyX now has "inverted" branch insets, which output their contents just in -case a given branch is not "activated". This makes inclusion of alternate -material in different versions easier. +* LyX now has "inverted" branch insets, which output their contents just in + case a given branch is not "activated". This makes inclusion of alternate + material in different versions easier. + +* When inserting a command or symbol in mathed, it is now automatically + wrapped in a real inset (either \text or \ensuremath) assuring the correct + mode, instead of being wrapped only in the output. The wrapping inset can + be safely dissolved, as it will be automatically inserted at export time + if needed, as usual. !!!The following pref variables were added in 2.3:
[LyX/master] Sort the language nesting mess with polyglossia
commit 3bc08a76c42cd350a3141f00f37082bc9fab8967 Author: Enrico Forestieri Date: Sat Sep 24 03:15:02 2016 +0200 Sort the language nesting mess with polyglossia When using polyglossia, lyx was making a real mess when changing language inside nested insets. The \begin{language} and \end{language} commands were not well paired such that they could easily occur just before and after the start or end of an environment. Of course this was causing latex errors such that "\begin{otherlanguage} ended by \end{environment}". There may still be some cases I did not take into account. --- src/output_latex.cpp | 159 ++ 1 files changed, 134 insertions(+), 25 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index f5c6a10..b584626 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -42,6 +42,7 @@ #include #include +#include using namespace std; using namespace lyx::support; @@ -61,13 +62,15 @@ enum OpenEncoding { struct OutputState { OutputState() : open_encoding_(none), cjk_inherited_(0), - prev_env_language_(0), open_polyglossia_lang_("") + prev_env_language_(0), nest_level_(0) { } OpenEncoding open_encoding_; int cjk_inherited_; Language const * prev_env_language_; - string open_polyglossia_lang_; + int nest_level_; + stack lang_switch_depth_; // Both are always empty when + stack open_polyglossia_lang_; // not using polyglossia }; @@ -82,6 +85,32 @@ OutputState * getOutputState() } +string const & openPolyglossiaLang(OutputState const * state) +{ + // Return a reference to the last active language opened with + // polyglossia. If none or when using babel, return a reference + // to an empty string. + + static string const empty; + + return state->open_polyglossia_lang_.empty() + ? empty + : state->open_polyglossia_lang_.top(); +} + + +bool atSameLastLangSwitchDepth(OutputState const * state) +{ + // Return true if the actual nest level is the same at which the + // language was switched when using polyglossia. Instead, return + // always true when using babel. + + return state->lang_switch_depth_.size() == 0 + ? true + : state->lang_switch_depth_.top() == state->nest_level_; +} + + string const getPolyglossiaEnvName(Language const * lang) { string result = lang->polyglossia(); @@ -163,9 +192,11 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, string const lang_end_command = use_polyglossia ? "\\end{$$lang}" : lyxrc.language_command_end; + // For polyglossia, switch language outside of environment, if possible. if (par_lang != prev_par_lang) { if (!lang_end_command.empty() && prev_par_lang != doc_lang && + atSameLastLangSwitchDepth(state) && !prev_par_lang.empty()) { os << from_ascii(subst( lang_end_command, @@ -173,10 +204,15 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, prev_par_lang)) // the '%' is necessary to prevent unwanted whitespace << "%\n"; + if (use_polyglossia) { + state->lang_switch_depth_.pop(); + state->open_polyglossia_lang_.pop(); + } } if ((lang_end_command.empty() || - par_lang != doc_lang) && + par_lang != doc_lang || + par_lang != openPolyglossiaLang(state)) && !par_lang.empty()) { string bc = use_polyglossia ? getPolyglossiaBegin(lang_begin_command, par_lang, @@ -185,6 +221,10 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, os << bc; // the '%' is necessary to prevent unwanted whitespace os << "%\n"; + if (use_polyglossia) { + state->lang_switch_depth_.push(state->nest_level_); + state->open_polyglossia_lang_.push(par_lang); + } } } @@ -197,8 +237,7 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } if (style.isEnvironment()) { - if (par_
[LyX/master] Correctly classify macros
commit 314e30d5fdd243fca204effb20acdd6b8b8469b1 Author: Enrico Forestieri Date: Sun Sep 25 01:11:16 2016 +0200 Correctly classify macros Some macros defined in the lib/symbols file are classified are texmode. But the MathMacro class was missing a currentMode method for returning this information. --- src/mathed/MathMacro.cpp | 15 --- src/mathed/MathMacro.h |2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index e1484e8..d1a8b50 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -614,9 +614,7 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const drawMarkers2(pi, expx, expy); } else { bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX; - bool user_macro = !MacroTable::globalMacros().get(name()); - bool upshape = user_macro ? false : d->macro_ && d->macro_->symbol() - && d->macro_->symbol()->extra == "textmode"; + bool upshape = currentMode() == TEXT_MODE; Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE : pi.base.font.shape()); @@ -753,6 +751,17 @@ size_t MathMacro::appetite() const } +InsetMath::mode_type MathMacro::currentMode() const +{ + // User defined macros are always assumed to be mathmode macros. + // Only the global macros defined in lib/symbols may be textmode. + + MacroData const * data = MacroTable::globalMacros().get(name()); + bool textmode = data && data->symbol() && data->symbol()->extra == "textmode"; + return textmode ? TEXT_MODE : MATH_MODE; +} + + void MathMacro::validate(LaTeXFeatures & features) const { // Immediately after a document is loaded, in some cases the MacroData diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index b389e27..1a8654a 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -70,6 +70,8 @@ public: /// void validate(LaTeXFeatures &) const; + /// + mode_type currentMode() const; /// void write(WriteStream & os) const;
[LyX/master] Do not confuse global commands with ERT macros
commit 6a3ced3cfb14c851053ddada9abaa9c3cd4f659d Author: Enrico Forestieri Date: Sun Sep 25 02:00:55 2016 +0200 Do not confuse global commands with ERT macros --- src/Cursor.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index bdd6986..2658d45 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1479,7 +1479,8 @@ bool Cursor::macroModeClose() bool keep_mathmode = it != words.end() && (it->second.inset == "font" || it->second.inset == "oldfont" || it->second.inset == "mbox"); - bool ert_macro = !user_macro && it == words.end(); + bool ert_macro = !user_macro && it == words.end() +&& !atom.nucleus()->asInsetMath(); if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE
[LyX/master] Correctly track opened polyglossia languages
commit 8c14d9e0413978aa11f581e9c6f2d0587bb0b189 Author: Enrico Forestieri Date: Sun Sep 25 08:20:34 2016 +0200 Correctly track opened polyglossia languages A language switch may also occur outside of output_latex.cpp, apparently. --- src/Font.cpp |3 +++ src/OutputParams.cpp |3 ++- src/OutputParams.h | 10 ++ src/Paragraph.cpp|2 ++ src/output_latex.cpp | 25 + src/output_latex.h |8 6 files changed, 50 insertions(+), 1 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index 0ca4080..f6eb6b9 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -287,6 +287,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, tmp += "{"; os << from_ascii(tmp); count += tmp.length(); + runparams.pushPolyglossiaLang(language()->polyglossia()); } else if (language()->encoding()->package() != Encoding::CJK) { os << '{'; count += 1; @@ -545,6 +546,8 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, && language()->encoding()->package() != Encoding::CJK) { os << '}'; ++count; + if (runparams.use_polyglossia) + runparams.popPolyglossiaLang(); } return count; diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 20c3a65..2b4c9d9 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -21,7 +21,8 @@ namespace lyx { OutputParams::OutputParams(Encoding const * enc) : flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false), moving_arg(false), intitle(false), inulemcmd(0), local_font(0), master_language(0), - encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false), + encoding(enc), pushPolyglossiaLang(0), popPolyglossiaLang(0), + free_spacing(false), use_babel(false), use_polyglossia(false), use_indices(false), use_japanese(false), linelen(0), depth(0), exportdata(new ExportData), inComment(false), inTableCell(NO), inFloat(NONFLOAT), diff --git a/src/OutputParams.h b/src/OutputParams.h index 3914617..4927085 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -141,6 +141,16 @@ public: */ mutable Encoding const * encoding; + /** Pointer to a function for registering a language switch + when using polyglossia. + */ + mutable void (* pushPolyglossiaLang)(std::string const & lang_name); + + /** Pointer to a function for unregistering the last language + switch when using polyglossia. + */ + mutable void (* popPolyglossiaLang)(); + /** free_spacing == true means that the inset is in a free-spacing paragraph. */ diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 94cf931..fd0f7fa 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2441,6 +2441,8 @@ void Paragraph::latex(BufferParams const & bparams, running_lang); os << from_ascii(end_tag); column += end_tag.length(); + if (runparams.use_polyglossia) + runparams.popPolyglossiaLang(); } // Switch file encoding if necessary (and allowed) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index b584626..0875fbf 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -478,6 +478,24 @@ void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeX } // namespace anon +void pushPolyglossiaLang(string const & lang_name) +{ + OutputState * state = getOutputState(); + + state->lang_switch_depth_.push(state->nest_level_); + state->open_polyglossia_lang_.push(lang_name); +} + + +void popPolyglossiaLang() +{ + OutputState * state = getOutputState(); + + state->lang_switch_depth_.pop(); + state->open_polyglossia_lang_.pop(); +} + + void latexArgInsets(Paragraph const & par, otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs, string const & prefix) { @@ -1265,8 +1283,15 @@ void latexParagraphs(Buffer const & buf, : subst(lang_begin_command, "$$lang", mainlang); os << bc; os << '\n'; + if (runparams.use_polyglossia) { + state->lang_switch_depth_.push(state->nest_level_); + state->open_polyglossia_lang_.pu
[LyX/master] No need to clutter runparams...
commit 4508a7f855976bb1b23d8f9008a331204f31e651 Author: Enrico Forestieri Date: Sun Sep 25 08:56:12 2016 +0200 No need to clutter runparams... --- src/Font.cpp |4 ++-- src/OutputParams.cpp |3 +-- src/OutputParams.h | 10 -- src/Paragraph.cpp|2 +- src/output_latex.cpp |3 --- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index f6eb6b9..95d015b 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -287,7 +287,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, tmp += "{"; os << from_ascii(tmp); count += tmp.length(); - runparams.pushPolyglossiaLang(language()->polyglossia()); + pushPolyglossiaLang(language()->polyglossia()); } else if (language()->encoding()->package() != Encoding::CJK) { os << '{'; count += 1; @@ -547,7 +547,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, os << '}'; ++count; if (runparams.use_polyglossia) - runparams.popPolyglossiaLang(); + popPolyglossiaLang(); } return count; diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 2b4c9d9..20c3a65 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -21,8 +21,7 @@ namespace lyx { OutputParams::OutputParams(Encoding const * enc) : flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false), moving_arg(false), intitle(false), inulemcmd(0), local_font(0), master_language(0), - encoding(enc), pushPolyglossiaLang(0), popPolyglossiaLang(0), - free_spacing(false), use_babel(false), use_polyglossia(false), + encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false), use_indices(false), use_japanese(false), linelen(0), depth(0), exportdata(new ExportData), inComment(false), inTableCell(NO), inFloat(NONFLOAT), diff --git a/src/OutputParams.h b/src/OutputParams.h index 4927085..3914617 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -141,16 +141,6 @@ public: */ mutable Encoding const * encoding; - /** Pointer to a function for registering a language switch - when using polyglossia. - */ - mutable void (* pushPolyglossiaLang)(std::string const & lang_name); - - /** Pointer to a function for unregistering the last language - switch when using polyglossia. - */ - mutable void (* popPolyglossiaLang)(); - /** free_spacing == true means that the inset is in a free-spacing paragraph. */ diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index fd0f7fa..3bdb4cc 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2442,7 +2442,7 @@ void Paragraph::latex(BufferParams const & bparams, os << from_ascii(end_tag); column += end_tag.length(); if (runparams.use_polyglossia) - runparams.popPolyglossiaLang(); + popPolyglossiaLang(); } // Switch file encoding if necessary (and allowed) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 0875fbf..c656ecf 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -1289,9 +1289,6 @@ void latexParagraphs(Buffer const & buf, } } - runparams.pushPolyglossiaLang = pushPolyglossiaLang; - runparams.popPolyglossiaLang = popPolyglossiaLang; - ParagraphList const & paragraphs = text.paragraphs(); if (runparams.par_begin == runparams.par_end) {
[LyX/master] Amend 6a3ced3c
commit 3bc80220a79dc7e02f90fa035b2afc102f9d531f Author: Enrico Forestieri Date: Sun Sep 25 18:59:07 2016 +0200 Amend 6a3ced3c ERT macros are also math insets, sigh... --- src/Cursor.cpp |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 2658d45..6f393e3 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1479,8 +1479,7 @@ bool Cursor::macroModeClose() bool keep_mathmode = it != words.end() && (it->second.inset == "font" || it->second.inset == "oldfont" || it->second.inset == "mbox"); - bool ert_macro = !user_macro && it == words.end() -&& !atom.nucleus()->asInsetMath(); + bool ert_macro = !user_macro && it == words.end() && atomAsMacro; if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE
[LyX/master] Do not rely on math macros being updated
commit 6642152e6610f1e885babfaeb3c99bd0004916fc Author: Enrico Forestieri Date: Sun Sep 25 20:31:13 2016 +0200 Do not rely on math macros being updated Trying to spare a few cycles by avoiding computing metrics during screen updates and export. See also 8f86ee74, 72cf7c8f, and e36a8903. Guillaume will tell whether this also avoids crashing his documents ;) --- src/BufferView.cpp |8 ++-- src/mathed/MathMacro.cpp | 10 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ad40dd6..cb7ea79 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -495,9 +495,7 @@ void BufferView::processUpdateFlags(Update::flags flags) // updateMetrics() does not update paragraph position // This is done at draw() time. So we need a redraw! - // We pass true so that metrics are computed for the sake - // of having MacroData updated. - buffer_.changed(true); + buffer_.changed(false); if (needsFitCursor()) { // The cursor is off screen so ensure it is visible. @@ -2167,9 +2165,7 @@ void BufferView::updateHoveredInset() const // This event (moving without mouse click) is not passed further. // This should be changed if it is further utilized. - // We pass true so that metrics are computed for the sake - // of having MacroData updated. - buffer_.changed(true); + buffer_.changed(false); } } diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index d1a8b50..06a55bf 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -939,11 +939,11 @@ bool MathMacro::folded() const void MathMacro::write(WriteStream & os) const { - bool user_macro = !MacroTable::globalMacros().get(name()); - bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol() - && d->macro_->symbol()->extra == "textmode"; - bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol() - || d->macro_->symbol()->extra != "textmode"); + MacroData const * data = MacroTable::globalMacros().get(name()); + bool textmode_macro = data && data->symbol() + && data->symbol()->extra == "textmode"; + bool needs_mathmode = data && (!data->symbol() + || data->symbol()->extra != "textmode"); MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
[LyX/master] Shut up compiler warning
commit f476d9c85ad63353b978481fde59659b870758fe Author: Enrico Forestieri Date: Tue Sep 27 21:32:40 2016 +0200 Shut up compiler warning --- src/output_latex.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index c656ecf..0765949 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -982,8 +982,8 @@ void TeXOnePar(Buffer const & buf, switch (style.latextype) { case LATEX_ITEM_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT: - if (nextpar && par_lang != nextpar_lang - && nextpar->getDepth() == par.getDepth() + if ((nextpar && par_lang != nextpar_lang +&& nextpar->getDepth() == par.getDepth()) || (atSameLastLangSwitchDepth(state) && nextpar && nextpar->getDepth() < par.getDepth())) close_lang_switch = use_polyglossia;
[LyX/master] Do not unnecessarily open the document language
commit e40fa86a975a5d3ec7ecc0a1d33d082774ba7cb2 Author: Enrico Forestieri Date: Tue Sep 27 21:41:13 2016 +0200 Do not unnecessarily open the document language If the document language is opened outside of any environement, we risk not closing it if no other language switch occurs. Indeed, the stack is emptied only at the end of an enviroment. We could of course also empty it at the end of the document, but we would have an unnecessary language switch. --- src/output_latex.cpp | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 0765949..4e40b6f 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -210,9 +210,17 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } } + // If no language was explicitly opened and we are using + // polyglossia, then the current polyglossia language is + // the document language. + string const & pol_lang = use_polyglossia + && state->lang_switch_depth_.size() + ? openPolyglossiaLang(state) + : doc_lang; + if ((lang_end_command.empty() || par_lang != doc_lang || - par_lang != openPolyglossiaLang(state)) && + par_lang != pol_lang) && !par_lang.empty()) { string bc = use_polyglossia ? getPolyglossiaBegin(lang_begin_command, par_lang,