]> git.lyx.org Git - features.git/commit
Fix pasting as LaTeX in documents with no modules
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 27 Oct 2022 15:26:53 +0000 (17:26 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 6 Nov 2022 12:20:02 +0000 (13:20 +0100)
commit90ea50811191dc891d2b3407c01527f1f2d745dd
treea49516021d0a9fd0195cb34e20cad8875777ea17
parent157d67d55d38ecd1893c0ec5f46d688a4aa91b42
Fix pasting as LaTeX in documents with no modules

When there is no module, the old code would invoke tex2lyx with option
 -m
instead of
 -m ""
and an error would ensue.

This is because the QProcess command line parser used in Systemcall is
broken and does not recognize empty parameters as such. The solution
is to rewrite our parsecmd() parser to generate a list of parameters.
This is post-2.4.0 work.

The workaround used here is:

- set the list of modules to "," when it should be empty. In effect,
  this is a list of two empty modules.

- change tex2lyx to accept empty module names and ignore them; this is
  good in terms of robustness anyway.

Additionally, when there is no receiving buffer, set the defaults as
the BufferParams defaults instead of empty (this is cleaner, but
should not make a difference in practice).

In the long term, we should switch to use the QStringList-based API of
QProcess in Systemcall (see QTBUG-80640).
src/BufferParams.cpp
src/BufferParams.h
src/Converter.cpp
src/support/Systemcall.cpp
src/tex2lyx/tex2lyx.cpp