Le 19/10/2015 23:58, Scott Kostyshak a écrit :
On Mon, Oct 19, 2015 at 07:56:13AM +0200, Guillaume Munch wrote:
commit 65d61e7a2786172da95ed9433ed0c49a7398f405
Author: Guillaume Munch <g...@lyx.org>
Date: Wed Oct 14 00:17:05 2015 +0100
Add math cell positions to TexRow
This is preliminary work for extending the cursor<->row tracking to math.
TexRow used to associate, to each row, a location id/pos where id
determines a
paragraph and pos the position in the paragraph.
TexRow now associates to each row a list of entries, text or math. A math
is a
pair uid/idx where uid will determine a math inset and idx is the number
of the
cell.
The analogy id/pos<->inset/idx works better than the analogy
id/pos<->idx/pos,
because what matters for the TexRow algorithm(TM) is the behaviour in
terms of
line breaks.
This only improves the source view and the forward search, not the error
report
and the reverse search (though this could be easily added now).
The following tests now time out because of this commit (at least a git
bisect suggests this):
export/examples/ja/knitr_pdf2
export/examples/ja/sweave_pdf3
export/examples/ja/knitr_pdf3
export/examples/ja/sweave_pdf
export/examples/ja/knitr_pdf
export/examples/ja/sweave_pdf2
The exports are supposed to fail because for Japanese it seems that
pdflatex does not work. In fact, before this commit, the error message
given from the logs is pretty informative:
! LaTeX Error: This file needs format `pLaTeX2e'
but this is `LaTeX2e'.
So the problem is not that the compilation does not succeed. The problem
is that after this commit, LyX's export does not finish.
Taking the example
export/examples/ja/sweave_pdf2
this is testing the export of the file lib/examples/ja/sweave.lyx with
pdflatex. When I do this manually (graphically or on command line) LyX
also seems to hang on the export.
In order to try to compile the file I believe you need to have R
installed. Do you have R installed? If not, are you interested in
installing it to debug this? I could explain how on Ubuntu. I would not
blame you if you are not interested installing a large package just to
debug this strange case (all the other four thousand tests are not
changed by this commit). Further, my (wild) guess is that the problem is
not because of your code directly, but because we probably don't handle
Japanese documents as good as we should. I can try to take a deeper look
if you don't want to look into it.
My guess is that the problem is because of my code. Since I cannot test
directly, please try the attached, I believe it fixes.
diff --git a/src/TexRow.cpp b/src/TexRow.cpp
index 4bec66e..1d1c80c 100644
--- a/src/TexRow.cpp
+++ b/src/TexRow.cpp
@@ -208,7 +208,7 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
if (row <= int(rowlist_.size()))
while (row > 0 && isNone(t = rowlist_[row - 1].getTextEntry()))
--row;
- if (row > 0)
+ if (!isNone(t))
ret = true;
id = t.id;
pos = t.pos;