This reverts the previous fix in [0a33374c/lyxgit] and fixes it
differently.
We always have to call 'notifyCursorLeaves', but we only have to make sure
that we call the 'fixIfBroken()' functions first.
We rely on the 'or' operator to prevent us from calling
'notifyCursorLeaves' if one of the two cursors is broken. This doesn't
work when using the '|' operator. The compiler 'optimizes' the code in
such a way that we always call notifyCursorLeaves anyway. Using the '||'
operator fixes this.
The undo range is extended to encompass all the paragraph after the end that
are a non-zero depth. The reason is that these paragraphs may see their depth
reduced if the last paragraph sees its depth reduced.
Note that there is a memory cost, since we store paragraphs than may not be
modified in practice. This may matter for some pathological files (people
putting all their document at depth 1 for a weird reason?)
I tried to be careful, but this can introduce new bugs. Please test.
Only user of this function is code that has been commented out, comment
out this function as well.
Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>
The check whether fname != oldname does not work for unnamed buffers.
Therefore, we check explicitly whether the Buffer that already exists with
the same name isn't really the buffer we are trying to save.
Text::outerFont looks recursively for paragraphs before the current one
which has a lower depth. If such a paragraph cannot be found, depthHook
and outerHook return the current paragraph. As such, we end up in an
infinite loop. So, if we find a par_depth that was the same as the
previous one, we apparently can't find a suitable paragraph and we should
quit the loop.
In this case, the working dir has already a slash at the end.
Appending another one would result in a path ending with a double slash,
which has a special meaning when used in TEXINPUTS (all subdirs would
be recursively scanned). So, avoid doing that.
We want the key as id, not the label (which is optional).
We also need a kind of namespace for the citation ids.
We should also clean the id tag before using it.
As long as leftMargin() is not correctly implemented for
MARGIN_RIGHT_ADDRESS_BOX, we should also not do this here. Otherwise, long
rows will be painted off the screen and will not be editable.