[LyX/master] Win installer: fix installation of Arabic dictionaries.nsh

2018-02-16 Thread Uwe Stöhr
commit ac1d6af008af9eea16496abd01914badb38e3b04
Author: Uwe Stöhr 
Date:   Sat Feb 17 06:05:13 2018 +0100

Win installer: fix installation of Arabic dictionaries.nsh

- correct name of Arabic spell checker (fixes bug #11036)
- add Arabic thesaurus
- update sourceforge's mirror list
- update some dictionaries
---
 .../Win32/packaging/installer/ChangeLog.txt|   12 +-
 .../packaging/installer/DictionaryMirrors.txt  |   41 ---
 .../installer/HunspellDictionaryNames.txt  |4 +-
 .../installer/ThesaurusDictionaryNames.txt |2 +
 .../packaging/installer/include/dictionaries.nsh   |   14 +++---
 .../Win32/packaging/installer/include/init.nsh |   24 +---
 6 files changed, 57 insertions(+), 40 deletions(-)

diff --git a/development/Win32/packaging/installer/ChangeLog.txt 
b/development/Win32/packaging/installer/ChangeLog.txt
index 0a276cf..4bf75a8 100644
--- a/development/Win32/packaging/installer/ChangeLog.txt
+++ b/development/Win32/packaging/installer/ChangeLog.txt
@@ -1,5 +1,15 @@
-Changelog for LyX-230-RC2:
+Changelog for LyX-230-1:
+- installs LyX 2.3.0
+- fix installation of Arabic spell checker
+- new thesaurus for Arabic
+- updated thesaurus for Ukrainian
+- updated spell checker dictionaries for Arabic, Breton and Ukrainian
+
+
+Changelog for LyX-230-RC2:
 - installs LyX 2.3.0 RC2
+- updated to Qt 5.9.4
+- updated to ImageMagick 7.0.7-22
 
 
 Changelog for LyX-230-RC1:
diff --git a/development/Win32/packaging/installer/DictionaryMirrors.txt 
b/development/Win32/packaging/installer/DictionaryMirrors.txt
index 434ea15..99a4590 100644
--- a/development/Win32/packaging/installer/DictionaryMirrors.txt
+++ b/development/Win32/packaging/installer/DictionaryMirrors.txt
@@ -1,29 +1,22 @@
-dfn
+astuteinternet
+ayera
+cfhcable
+cytranet
+excellmedia
 freefr
-cznic
-garr
-optimate
-kaz
-kent
-heanet
-hivelocity
-ignum
-internode
 iweb
 jaist
-netcologne
-switch
+kent
+liquidtelecom
 nchc
-ncu
-skylink
-tcpdiag
-tenet
-ufpr
-waia
-colocrossing
-citylan
-aarnet
+netcologne
+netix
+netcologne
+newcontinuum
+phoenixnap
+razaoinfo
 superb-dca2
-superb-dca3
-softlayer-ams
-softlayer-dal
+superb-sea2
+ufpr
+versaweb
+vorboss
diff --git a/development/Win32/packaging/installer/HunspellDictionaryNames.txt 
b/development/Win32/packaging/installer/HunspellDictionaryNames.txt
index ff7b103..817adc9 100644
--- a/development/Win32/packaging/installer/HunspellDictionaryNames.txt
+++ b/development/Win32/packaging/installer/HunspellDictionaryNames.txt
@@ -1,7 +1,7 @@
 af_ZA.aff
 af_ZA.dic
-ar_DZ.aff
-ar_DZ.dic
+ar_SA.aff
+ar_SA.dic
 be_BY.aff
 be_BY.dic
 bg_BG.aff
diff --git a/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt 
b/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
index 6d19dfa..27e248f 100644
--- a/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
+++ b/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
@@ -1,3 +1,5 @@
+th_ar_SA_v2.dat
+th_ar_SA_v2.idx
 th_bg_BG_v2.dat
 th_bg_BG_v2.idx
 th_ca_ES_v2.dat
diff --git a/development/Win32/packaging/installer/include/dictionaries.nsh 
b/development/Win32/packaging/installer/include/dictionaries.nsh
index 8119a06..415b19c 100644
--- a/development/Win32/packaging/installer/include/dictionaries.nsh
+++ b/development/Win32/packaging/installer/include/dictionaries.nsh
@@ -43,8 +43,8 @@ Function FindDictionaries
   
   # read out the possible thesaurus filenames from the file
   FileOpen $R5 "$INSTDIR\Resources\ThesaurusDictionaryNames.txt" r
-  ${for} $5 1 27
-   # the file has 54 lines, but we only need to check for one of the 2 
thesaurus files per language
+  ${for} $5 1 28
+   # the file has 56 lines, but we only need to check for one of the 2 
thesaurus files per language
# therefore check only for every second line
FileRead $R5 $String # $String is now the dictionary name
FileRead $R5 $String # $String is now the dictionary name
@@ -77,11 +77,11 @@ Function DownloadHunspellDictionaries
# if first download repository is not available try the other ones listed 
in "DictionaryMirrors.txt"
FileOpen $R4 "$INSTDIR\Resources\DictionaryMirrors.txt" r

-   ${For} $4 1 29 # there are 29 mirrors in the file
+   ${For} $4 1 22 # there are 22 mirrors in the file
 FileRead $R4 $Search # $Search is now the mirror
 StrCpy $Search $Search -2 # delete the linebreak characters at the end
 Push $R0
-inetc::get /TIMEOUT=5000 
"http://$Search.dl.sourceforge.net/project/lyxwininstaller/hunspell/$String; 
"$INSTDIR\Resources\dicts\$String" /END
+inetc::get /TIMEOUT=5000 
"https://$Search.dl.sourceforge.net/project/lyxwininstaller/hunspell/$String; 
"$INSTDIR\Resources\dicts\$String" /END
 Pop $R0
 ${if} $R0 == "OK"
  ${ExitFor}
@@ -112,7 +112,7 @@ Function DownloadThesaurusDictionaries
  
  # read out the locations from the file
  FileOpen $R5 

[LyX/2.2.x] Win installer: fix installation of Arabic dictionaries.nsh

2018-02-16 Thread Uwe Stöhr
commit 21586c196aef9c75e70a84c448841ba617c2e1ea
Author: Uwe Stöhr 
Date:   Sat Feb 17 06:02:38 2018 +0100

Win installer: fix installation of Arabic dictionaries.nsh

- correct name of Arabic spell checker (fixes bug #11036)
- add Arabic thesaurus
- update sourceforge's mirror list
- update some dictionaries
---
 .../Win32/packaging/installer/ChangeLog.txt|4 ++
 .../packaging/installer/DictionaryMirrors.txt  |   41 ---
 .../installer/HunspellDictionaryNames.txt  |4 +-
 .../installer/ThesaurusDictionaryNames.txt |2 +
 .../packaging/installer/include/dictionaries.nsh   |   14 +++---
 .../Win32/packaging/installer/include/init.nsh |   27 ++---
 6 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/development/Win32/packaging/installer/ChangeLog.txt 
b/development/Win32/packaging/installer/ChangeLog.txt
index 5a23905..096b2dc 100644
--- a/development/Win32/packaging/installer/ChangeLog.txt
+++ b/development/Win32/packaging/installer/ChangeLog.txt
@@ -1,6 +1,10 @@
 Changelog for LyX-224-1:
 - installs LyX 2.2.4
 - new Russian translation of the installer messages
+- fix installation of Arabic spell checker
+- new thesaurus for Arabic
+- updated thesaurus for Ukrainian
+- updated spell checker dictionaries for Arabic, Breton and Ukrainian
 
 
 Changelog for LyX-223-2:
diff --git a/development/Win32/packaging/installer/DictionaryMirrors.txt 
b/development/Win32/packaging/installer/DictionaryMirrors.txt
index 434ea15..99a4590 100644
--- a/development/Win32/packaging/installer/DictionaryMirrors.txt
+++ b/development/Win32/packaging/installer/DictionaryMirrors.txt
@@ -1,29 +1,22 @@
-dfn
+astuteinternet
+ayera
+cfhcable
+cytranet
+excellmedia
 freefr
-cznic
-garr
-optimate
-kaz
-kent
-heanet
-hivelocity
-ignum
-internode
 iweb
 jaist
-netcologne
-switch
+kent
+liquidtelecom
 nchc
-ncu
-skylink
-tcpdiag
-tenet
-ufpr
-waia
-colocrossing
-citylan
-aarnet
+netcologne
+netix
+netcologne
+newcontinuum
+phoenixnap
+razaoinfo
 superb-dca2
-superb-dca3
-softlayer-ams
-softlayer-dal
+superb-sea2
+ufpr
+versaweb
+vorboss
diff --git a/development/Win32/packaging/installer/HunspellDictionaryNames.txt 
b/development/Win32/packaging/installer/HunspellDictionaryNames.txt
index ff7b103..817adc9 100644
--- a/development/Win32/packaging/installer/HunspellDictionaryNames.txt
+++ b/development/Win32/packaging/installer/HunspellDictionaryNames.txt
@@ -1,7 +1,7 @@
 af_ZA.aff
 af_ZA.dic
-ar_DZ.aff
-ar_DZ.dic
+ar_SA.aff
+ar_SA.dic
 be_BY.aff
 be_BY.dic
 bg_BG.aff
diff --git a/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt 
b/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
index 6d19dfa..27e248f 100644
--- a/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
+++ b/development/Win32/packaging/installer/ThesaurusDictionaryNames.txt
@@ -1,3 +1,5 @@
+th_ar_SA_v2.dat
+th_ar_SA_v2.idx
 th_bg_BG_v2.dat
 th_bg_BG_v2.idx
 th_ca_ES_v2.dat
diff --git a/development/Win32/packaging/installer/include/dictionaries.nsh 
b/development/Win32/packaging/installer/include/dictionaries.nsh
index 8119a06..415b19c 100644
--- a/development/Win32/packaging/installer/include/dictionaries.nsh
+++ b/development/Win32/packaging/installer/include/dictionaries.nsh
@@ -43,8 +43,8 @@ Function FindDictionaries
   
   # read out the possible thesaurus filenames from the file
   FileOpen $R5 "$INSTDIR\Resources\ThesaurusDictionaryNames.txt" r
-  ${for} $5 1 27
-   # the file has 54 lines, but we only need to check for one of the 2 
thesaurus files per language
+  ${for} $5 1 28
+   # the file has 56 lines, but we only need to check for one of the 2 
thesaurus files per language
# therefore check only for every second line
FileRead $R5 $String # $String is now the dictionary name
FileRead $R5 $String # $String is now the dictionary name
@@ -77,11 +77,11 @@ Function DownloadHunspellDictionaries
# if first download repository is not available try the other ones listed 
in "DictionaryMirrors.txt"
FileOpen $R4 "$INSTDIR\Resources\DictionaryMirrors.txt" r

-   ${For} $4 1 29 # there are 29 mirrors in the file
+   ${For} $4 1 22 # there are 22 mirrors in the file
 FileRead $R4 $Search # $Search is now the mirror
 StrCpy $Search $Search -2 # delete the linebreak characters at the end
 Push $R0
-inetc::get /TIMEOUT=5000 
"http://$Search.dl.sourceforge.net/project/lyxwininstaller/hunspell/$String; 
"$INSTDIR\Resources\dicts\$String" /END
+inetc::get /TIMEOUT=5000 
"https://$Search.dl.sourceforge.net/project/lyxwininstaller/hunspell/$String; 
"$INSTDIR\Resources\dicts\$String" /END
 Pop $R0
 ${if} $R0 == "OK"
  ${ExitFor}
@@ -112,7 +112,7 @@ Function DownloadThesaurusDictionaries
  
  # read out the locations from the file
  FileOpen $R5 "$INSTDIR\Resources\ThesaurusDictionaryNames.txt" r
- ${For} $5 1 54 # the file has 52 lines
+ ${For} $5 1 56 # 

[LyX/2.3.1-staging] Do not use English, but the context language, when pasting from math

2018-02-16 Thread Juergen Spitzmueller
commit 2c0d681b2177738362c9c752bc1a10268e247603
Author: Juergen Spitzmueller 
Date:   Tue Feb 6 14:10:12 2018 +0100

Do not use English, but the context language, when pasting from math

Fixes: #2596
(cherry picked from commit 92990adc236b19277a80c82ffa0580f5d1555bb0)
---
 src/CutAndPaste.cpp |5 -
 status.23x  |3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 85bd551..a6aa029 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -1037,7 +1037,10 @@ void copySelectionToStack(Cursor const & cur, CutStack & 
cutstack)
BufferParams const & bp = cur.buffer()->params();
// FIXME This should be the plain layout...right?
par.setLayout(bp.documentClass().plainLayout());
-   par.insert(0, grabSelection(cur), Font(), 
Change(Change::UNCHANGED));
+   // For pasting into text, we set the language to the paragraph 
language
+   // (rather than the default_language which is always English; 
see #2596)
+   par.insert(0, grabSelection(cur), Font(sane_font, 
par.getParLanguage(bp)),
+  Change(Change::UNCHANGED));
pars.push_back(par);
cutstack.push(make_pair(pars, bp.documentClassPtr()));
}
diff --git a/status.23x b/status.23x
index c186061..4e2348d 100644
--- a/status.23x
+++ b/status.23x
@@ -49,6 +49,9 @@ What's new
 - Do not use English, but the context language, when pasting from LaTeX
   (bug 9199).
 
+- Do not use English, but the context language, when pasting from math
+  (bug 2596).
+
 
 * INTERNALS
 


[LyX/2.3.1-staging] Status file for 2.3.1

2018-02-16 Thread Richard Heck
commit e009bbd115c55ad6e0ffc4c27ec3f142a0a33e5f
Author: Richard Heck 
Date:   Fri Feb 16 12:02:57 2018 -0500

Status file for 2.3.1
---
 status.23x |   59 +++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/status.23x b/status.23x
new file mode 100644
index 000..531853b
--- /dev/null
+++ b/status.23x
@@ -0,0 +1,59 @@
+-*- text -*-
+
+This file describes what has been done in the preparation of LyX 2.3.1.
+All comments are welcome.
+
+We try to group things by topic and in decreasing order of importance.
+Please feel free to re-arrange if that seems like a good idea.
+
+
+What's new
+==
+
+** Updates:
+***
+
+* DOCUMENT INPUT/OUTPUT
+
+
+* TEX2LYX IMPROVEMENTS
+
+
+* USER INTERFACE
+
+
+* DOCUMENTATION AND LOCALIZATION
+
+
+* BUILD/INSTALLATION
+
+
+
+** Bug fixes:
+*
+
+* DOCUMENT INPUT/OUTPUT
+
+
+* LYX2LYX
+
+
+* USER INTERFACE
+
+
+* INTERNALS
+
+
+* DOCUMENTATION AND LOCALIZATION
+
+
+* LYXHTML
+
+
+* TEX2LYX
+
+
+* ADVANCED FIND AND REPLACE
+
+
+* BUILD/INSTALLATION


[LyX/2.3.2-staging] Open intitle command explicitly also for passthru.

2018-02-16 Thread Juergen Spitzmueller
commit d20de88953e260d081c0a917bcbec3c0cc6b3e96
Author: Juergen Spitzmueller 
Date:   Wed Dec 27 11:49:54 2017 +0100

Open intitle command explicitly also for passthru.

(cherry picked from commit 87960e3dd892cd7c60925efd44d40f593ac7883e)
---
 src/output_latex.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index f8bb151..67f9bdd 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -736,9 +736,13 @@ void TeXOnePar(Buffer const & buf,
Paragraph const * nextpar = runparams.isLastPar
? 0 : (pit + 1);
 
+   bool const intitle_command = style.intitle && style.latextype == 
LATEX_COMMAND;
+
if (style.pass_thru) {
Font const outerfont = text.outerFont(pit);
parStartCommand(par, os, runparams, style);
+   if (intitle_command)
+   os << '{';
 
par.latex(bparams, outerfont, os, runparams, start_pos, 
end_pos, force);
 
@@ -815,7 +819,6 @@ void TeXOnePar(Buffer const & buf,
 
// For InTitle commands, we need to switch the language inside the 
command
// (see #10849); thus open the command here.
-   bool const intitle_command = style.intitle && style.latextype == 
LATEX_COMMAND;
if (intitle_command) {
parStartCommand(par, os, runparams, style);
os << '{';


[LyX/2.3.2-staging] Use TeXOnePar for the inpreamble layouts

2018-02-16 Thread Juergen Spitzmueller
commit da3dc1b61f5de4eee3a38d9bf72a63852fea1332
Author: Juergen Spitzmueller 
Date:   Tue Dec 26 13:11:00 2017 +0100

Use TeXOnePar for the inpreamble layouts

This considers paragraph language and spacing (and simplifies the code)

(cherry picked from commit a2f886d52617815e8c80f12ef66198307d3432d6)
---
 src/Paragraph.cpp|   35 ++-
 src/output_latex.cpp |   11 ++-
 src/output_latex.h   |3 ++-
 3 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 8830efb..52bc993 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1437,9 +1437,7 @@ bool Paragraph::Private::latexSpecialT3(char_type const 
c, otexstream & os,
 void Paragraph::Private::validate(LaTeXFeatures & features) const
 {
if (layout_->inpreamble && inset_owner_) {
-   bool const is_command = layout_->latextype == LATEX_COMMAND;
-   Font f;
-   // Using a string stream here circumvents the encoding
+   // FIXME: Using a string stream here circumvents the encoding
// switching machinery of odocstream. Therefore the
// output is wrong if this paragraph contains content
// that needs to switch encoding.
@@ -1448,32 +1446,11 @@ void Paragraph::Private::validate(LaTeXFeatures & 
features) const
? buf.masterParams() : buf.params();
otexstringstream os;
os << layout_->preamble();
-   if (is_command) {
-   os << '\\' << from_ascii(layout_->latexname());
-   // we have to provide all the optional arguments here, 
even though
-   // the last one is the only one we care about.
-   // Separate handling of optional argument inset.
-   if (!layout_->latexargs().empty()) {
-   OutputParams rp = features.runparams();
-   rp.local_font = 
_->getFirstFontSettings(bp);
-   latexArgInsets(*owner_, os, rp, 
layout_->latexargs());
-   }
-   os << from_ascii(layout_->latexparam());
-   }
size_t const length = os.length();
-   // this will output "{" at the beginning, but not at the end
-   owner_->latex(bp, f, os, features.runparams(), 0, -1, true);
-   if (os.length() > length) {
-   if (is_command) {
-   os << '}';
-   if (!layout_->postcommandargs().empty()) {
-   OutputParams rp = features.runparams();
-   rp.local_font = 
_->getFirstFontSettings(bp);
-   latexArgInsets(*owner_, os, rp, 
layout_->postcommandargs(), "post:");
-   }
-   }
+   TeXOnePar(buf, buf.text(), 
buf.getParFromID(owner_->id()).pit(), os,
+ features.runparams(), string(), 0, -1, true);
+   if (os.length() > length)
features.addPreambleSnippet(os.release(), true);
-   }
}
 
if (features.runparams().flavor == OutputParams::HTML
@@ -2428,7 +2405,7 @@ void Paragraph::latex(BufferParams const & bparams,
if (empty()) {
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
-   if (style.isCommand() && (!style.intitle || style.inpreamble)) {
+   if (style.isCommand() && !style.intitle) {
os << '{';
++column;
}
@@ -2468,7 +2445,7 @@ void Paragraph::latex(BufferParams const & bparams,
}
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
-   if (style.isCommand() && (!style.intitle || 
style.inpreamble)) {
+   if (style.isCommand() && !style.intitle) {
os << '{';
++column;
}
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 5cac0ad..f8bb151 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -683,7 +683,8 @@ void TeXOnePar(Buffer const & buf,
   otexstream & os,
   OutputParams const & runparams_in,
   string const & everypar,
-  int start_pos, int end_pos)
+  int start_pos, int end_pos,
+  bool const force)
 {
BufferParams const & bparams = runparams_in.is_child
? buf.masterParams() : buf.params();
@@ -694,7 +695,7 @@ void TeXOnePar(Buffer const & buf,
Layout const & style = 

[LyX/2.3.2-staging] Fix switch of language and line spacing in InTitle commands.

2018-02-16 Thread Juergen Spitzmueller
commit bd879efaa8107b9064124c186967a500a53e7807
Author: Juergen Spitzmueller 
Date:   Sat Dec 23 13:25:13 2017 +0100

Fix switch of language and line spacing in InTitle commands.

Fixes: #9332, #10849
(cherry picked from commit 49e3f8e830a7c8a15f4d9f73e4dab78e93b24bf7)
---
 src/Paragraph.cpp|8 +++-
 src/Spacing.cpp  |   22 
 src/Spacing.h|3 ++
 src/output_latex.cpp |   88 +-
 4 files changed, 96 insertions(+), 25 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index c905856..dd0920b 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2426,7 +2426,9 @@ void Paragraph::latex(BufferParams const & bparams,
 
// if the paragraph is empty, the loop will not be entered at all
if (empty()) {
-   if (style.isCommand()) {
+   // For InTitle commands, we have already opened a group
+   // in output_latex::TeXOnePar.
+   if (style.isCommand() && style.intitle) {
os << '{';
++column;
}
@@ -2464,7 +2466,9 @@ void Paragraph::latex(BufferParams const & bparams,
os << "}] ";
column +=3;
}
-   if (style.isCommand()) {
+   // For InTitle commands, we have already opened a group
+   // in output_latex::TeXOnePar.
+   if (style.isCommand() && !style.intitle) {
os << '{';
++column;
}
diff --git a/src/Spacing.cpp b/src/Spacing.cpp
index cd5816e..9ac8345 100644
--- a/src/Spacing.cpp
+++ b/src/Spacing.cpp
@@ -99,6 +99,18 @@ string envName(Spacing::Space space, bool useSetSpace)
return useSetSpace ? name : support::ascii_lowercase(name);
 }
 
+string cmdName(Spacing::Space space, bool useSetSpace)
+{
+   static char const * const cmd_names[]
+   = { "SingleSpacing", "OnehalfSpacing", "DoubleSpacing", 
"SetStretch", ""};
+   string const name = cmd_names[space];
+
+   if (useSetSpace && name == "SetStretch")
+   return "setSpacing";
+
+   return useSetSpace ? name : support::ascii_lowercase(name);
+}
+
 } // namespace
 
 string const Spacing::writeEnvirBegin(bool useSetSpace) const
@@ -118,6 +130,16 @@ string const Spacing::writeEnvirEnd(bool useSetSpace) const
 }
 
 
+string const Spacing::writeCmd(bool useSetSpace) const
+{
+   string const name = cmdName(space, useSetSpace);
+   if (space == Other)
+   return "\\" + name + "{" + getValueAsString() + '}';
+   else
+   return name.empty() ? string() : "\\" + name + "{}";
+}
+
+
 string const Spacing::writePreamble(bool useSetSpace) const
 {
string preamble;
diff --git a/src/Spacing.h b/src/Spacing.h
index 274cfc2..7311f79 100644
--- a/src/Spacing.h
+++ b/src/Spacing.h
@@ -62,6 +62,9 @@ public:
std::string const writeEnvirEnd(bool useSetSpace) const;
/// useSetSpace is true when using the variant supported by
/// the memoir class.
+   std::string const writeCmd(bool useSetSpace) const;
+   /// useSetSpace is true when using the variant supported by
+   /// the memoir class.
std::string const writePreamble(bool useSetSpace) const;
 
 private:
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 0ee9af1..5cac0ad 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -812,6 +812,14 @@ void TeXOnePar(Buffer const & buf,
bool const using_begin_end = use_polyglossia ||
!lang_end_command.empty();
 
+   // For InTitle commands, we need to switch the language inside the 
command
+   // (see #10849); thus open the command here.
+   bool const intitle_command = style.intitle && style.latextype == 
LATEX_COMMAND;
+   if (intitle_command) {
+   parStartCommand(par, os, runparams, style);
+   os << '{';
+   }
+
// In some insets (such as Arguments), we cannot use \selectlanguage
bool const localswitch = text.inset().forceLocalFontSwitch()
|| (using_begin_end && text.inset().forcePlainLayout());
@@ -975,19 +983,34 @@ void TeXOnePar(Buffer const & buf,
os << "\n\\appendix\n";
}
 
-   if (!par.params().spacing().isDefault()
-   && (pit == 0 || !priorpar->hasSameLayout(par)))
-   {
-   os << 
from_ascii(par.params().spacing().writeEnvirBegin(useSetSpace))
-   << '\n';
-   }
+   // InTitle commands must use switches (not environments)
+   // inside the commands (see #9332)
+   if (style.intitle) {
+   if 

[LyX/2.3.2-staging] Fix inpreamble styles.

2018-02-16 Thread Juergen Spitzmueller
commit 961b79975c1578c2f35c7c2ff54559d6e54af7a1
Author: Juergen Spitzmueller 
Date:   Tue Dec 26 11:40:58 2017 +0100

Fix inpreamble styles.

(cherry picked from commit e55e9c842f25b4425db362cd5cb487187f34ba2b)
---
 src/Paragraph.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index dd0920b..8830efb 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2428,7 +2428,7 @@ void Paragraph::latex(BufferParams const & bparams,
if (empty()) {
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
-   if (style.isCommand() && style.intitle) {
+   if (style.isCommand() && (!style.intitle || style.inpreamble)) {
os << '{';
++column;
}
@@ -2468,7 +2468,7 @@ void Paragraph::latex(BufferParams const & bparams,
}
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
-   if (style.isCommand() && !style.intitle) {
+   if (style.isCommand() && (!style.intitle || 
style.inpreamble)) {
os << '{';
++column;
}


[LyX/2.3.2-staging] Recreate citation label after paste

2018-02-16 Thread Juergen Spitzmueller
commit c0ef31d9b9816a81d00ae3f37625ff69e1be30ec
Author: Juergen Spitzmueller 
Date:   Wed Dec 6 09:11:18 2017 +0100

Recreate citation label after paste

Fixes: #10829
(cherry picked from commit 7e34e659431691fd723e408010f90973c0a25b39)
---
 src/CutAndPaste.cpp|   11 +++
 src/insets/InsetCitation.h |2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index f611d59..57a8313 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -40,6 +40,7 @@
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetBranch.h"
+#include "insets/InsetCitation.h"
 #include "insets/InsetCommand.h"
 #include "insets/InsetFlex.h"
 #include "insets/InsetGraphics.h"
@@ -357,6 +358,16 @@ pasteSelectionHelper(DocIterator const & cur, 
ParagraphList const & parlist,
break;
}
 
+   case CITE_CODE: {
+   InsetCitation & cit = static_cast(*it);
+   // This actually only needs to be done if the cite 
engine
+   // differs, but we do it in general.
+   cit.redoLabel();
+   // We need to update the list of citations.
+   need_update = true;
+   break;
+   }
+
case BIBITEM_CODE: {
// check for duplicates
InsetBibitem & bib = static_cast(*it);
diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
index 992a85e..3e5e3ba 100644
--- a/src/insets/InsetCitation.h
+++ b/src/insets/InsetCitation.h
@@ -82,6 +82,8 @@ public:
static bool isCompatibleCommand(std::string const &);
//@}
///
+   void redoLabel() { cache.recalculate = true; }
+   ///
CitationStyle getCitationStyle(BufferParams const & bp, std::string 
const & input,
   std::vector const & 
valid_styles) const;
///


[LyX/2.3.2-staging] Revove unused variable

2018-02-16 Thread Juergen Spitzmueller
commit a26173f171bbb11504f3d81f0d882bd6b6e67359
Author: Juergen Spitzmueller 
Date:   Fri Feb 16 17:47:14 2018 +0100

Revove unused variable
---
 src/Paragraph.cpp |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 52bc993..135cd80 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1442,8 +1442,6 @@ void Paragraph::Private::validate(LaTeXFeatures & 
features) const
// output is wrong if this paragraph contains content
// that needs to switch encoding.
Buffer const & buf = inset_owner_->buffer();
-   BufferParams const & bp = features.runparams().is_child
-   ? buf.masterParams() : buf.params();
otexstringstream os;
os << layout_->preamble();
size_t const length = os.length();


[LyX/2.3.1-staging] Do not use English, but the context language, when pasting from LaTeX

2018-02-16 Thread Juergen Spitzmueller
commit 0e57e3e3f56de48147c765489eca91a165dd9989
Author: Juergen Spitzmueller 
Date:   Tue Feb 6 13:20:45 2018 +0100

Do not use English, but the context language, when pasting from LaTeX

Fixes: #9199
(cherry picked from commit e85704020ba613594a38e6f016ca7905c8f84c94)
---
 src/CutAndPaste.cpp |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index f611d59..85bd551 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -1222,6 +1222,10 @@ bool pasteClipboardText(Cursor & cur, ErrorList & 
errorList, bool asParagraphs,
Buffer buffer("", false);
buffer.setUnnamed(true);
available = buffer.importString(names[i], text, 
errorList);
+   // TeX2lyx (also used in the HTML chain) 
assumes English as document language
+   // if no language is explicitly set (as is the 
case here).
+   // We thus reset the temp buffer's language to 
the context language
+   buffer.changeLanguage(buffer.language(), 
cur.getFont().language());
if (available)
available = 
!buffer.paragraphs().empty();
if (available && 
!buffer.paragraphs()[0].empty()) {


[LyX/2.3.1-staging] Disable CheckTeX while buffer is processed

2018-02-16 Thread Juergen Spitzmueller
commit 482de36876f672ec09afd73d916bc66ce93f7ff4
Author: Juergen Spitzmueller 
Date:   Sat Feb 10 18:18:43 2018 +0100

Disable CheckTeX while buffer is processed

Since CheckTeX itself processes the tex file, a synchronous run with
a TeX process can lead to all sorts of conflicts, including crashes.

Fixes: #7434.
(cherry picked from commit 71fea6332667e1a9fe99c38624e4dcaf1129d6c5)
---
 lib/ui/stdmenus.inc   |2 +-
 src/Buffer.cpp|8 
 src/frontends/qt4/GuiView.cpp |   18 ++
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc
index 37c1067..d1f145c 100644
--- a/lib/ui/stdmenus.inc
+++ b/lib/ui/stdmenus.inc
@@ -594,7 +594,7 @@ Menuset
Item "Spellchecker...|S" "dialog-show spellchecker"
OptItem "Thesaurus...|T" "thesaurus-entry"
Item "Statistics...|a" "statistics"
-   OptItem "Check TeX|h" "buffer-chktex"
+   Item "Check TeX|h" "buffer-chktex"
Item "TeX Information|I" "dialog-show texinfo"
Item "Compare...|C" "dialog-show compare"
Separator
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index cd49a68..a8d1b2b 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2567,10 +2567,6 @@ bool Buffer::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
break;
}
 
-   case LFUN_BUFFER_CHKTEX:
-   enable = params().isLatex() && !lyxrc.chktex_command.empty();
-   break;
-
case LFUN_BUILD_PROGRAM:
enable = params().isExportable("program", false);
break;
@@ -2682,10 +2678,6 @@ void Buffer::dispatch(FuncRequest const & func, 
DispatchResult & dr)
break;
}
 
-   case LFUN_BUFFER_CHKTEX:
-   runChktex();
-   break;
-
case LFUN_BUFFER_EXPORT_CUSTOM: {
string format_name;
string command = split(argument, format_name, ' ');
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index e511cd6..87260cb 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1941,6 +1941,19 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
enable = theBufferList().last() != theBufferList().first();
break;
 
+   case LFUN_BUFFER_CHKTEX: {
+   if (!doc_buffer || !doc_buffer->params().isLatex()
+   || d.processing_thread_watcher_.isRunning()) {
+   // grey out, don't hide
+   enable = false;
+   break;
+   }
+   // hide if we have no checktex command
+   enable = !lyxrc.chktex_command.empty();
+   flag.setUnknown(!enable);
+   break;
+   }
+
case LFUN_VIEW_SPLIT:
if (cmd.getArg(0) == "vertical")
enable = doc_buffer && (d.splitter_->count() == 1 ||
@@ -3800,6 +3813,11 @@ void GuiView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
gotoNextOrPreviousBuffer(PREVBUFFER, true);
break;
 
+   case LFUN_BUFFER_CHKTEX:
+   LASSERT(doc_buffer, break);
+   doc_buffer->runChktex();
+   break;
+
case LFUN_COMMAND_EXECUTE: {
command_execute_ = true;
minibuffer_focus_ = true;


[LyX/2.3.1-staging] amend 71fea633266

2018-02-16 Thread Juergen Spitzmueller
commit 262bb7e2ce773489d39a80bdfee23fbf0165aa47
Author: Juergen Spitzmueller 
Date:   Sat Feb 10 19:02:35 2018 +0100

amend 71fea633266

(cherry picked from commit be4d49ebd107cb4b91844a555302a6052457c483)
---
 src/frontends/qt4/GuiView.cpp |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 87260cb..e043bc2 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1942,15 +1942,19 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
break;
 
case LFUN_BUFFER_CHKTEX: {
+   // hide if we have no checktex command
+   if (lyxrc.chktex_command.empty()) {
+   flag.setUnknown(true);
+   enable = false;
+   break;
+   }
if (!doc_buffer || !doc_buffer->params().isLatex()
|| d.processing_thread_watcher_.isRunning()) {
// grey out, don't hide
enable = false;
break;
}
-   // hide if we have no checktex command
-   enable = !lyxrc.chktex_command.empty();
-   flag.setUnknown(!enable);
+   enable = true;
break;
}
 


[LyX/2.3.1-staging] Disable BUFFER_EXPORT and BUFFER_EXPORT_AS while buffer is processed

2018-02-16 Thread Juergen Spitzmueller
commit a655ef69a864696569c36ee080923e579d3f1e67
Author: Juergen Spitzmueller 
Date:   Sun Feb 11 09:50:38 2018 +0100

Disable BUFFER_EXPORT and BUFFER_EXPORT_AS while buffer is processed

I am rather irritated we didn't do this already, since synchronous runs
with BUFFER_VIEW or BUFFER_UPDATE leads to all sorts of problems,
including crashes.

Fixes the crash in #8338 (but not the bug itself).

(cherry picked from commit 1437ae3f9cf78ffd5c639cb4e70a0b1fba9f600e)
---
 src/frontends/qt4/GuiView.cpp |   16 +++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index c587460..e511cd6 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1913,8 +1913,22 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
enable = doc_buffer && 
doc_buffer->notifiesExternalModification();
break;
 
-   case LFUN_BUFFER_WRITE_AS:
+   case LFUN_BUFFER_EXPORT: {
+   if (!doc_buffer || d.processing_thread_watcher_.isRunning()) {
+   enable = false;
+   break;
+   }
+   return doc_buffer->getStatus(cmd, flag);
+   break;
+   }
+
case LFUN_BUFFER_EXPORT_AS:
+   if (!doc_buffer || d.processing_thread_watcher_.isRunning()) {
+   enable = false;
+   break;
+   }
+   // fall through
+   case LFUN_BUFFER_WRITE_AS:
enable = doc_buffer != 0;
break;