On Thu, Aug 17, 2006 at 01:13:37PM +0200, Jean-Marc Lasgouttes wrote:

> OK, I see it indeed. What happens is that, when the script inset
> deletes its superscript, all that remains is a script inset with only
> one cell. Any undo concerning this inset will contain only the script
> "x", which is parsed as a single character, not a scriptinset.
> 
> Actually, when it does not have any script, the script inset should
> commit suicide and replace itself with its contents. This is what this
> updated patch does. I checked that it works and valgrind does not
> complain. 
> 
> Please test. I am unsure of the unintended consequences of this patch
> (recordUndoInset semantics changes, scriptinset suicide,
> scriptinset::write changes). Only the addition of the recordUndoInset
> calls is trivially correct.

This patch fixes it. However, as I am a bad guy, I found another problem ;-)
(I wish I have a better grasp of the sources such that to be helpful
instead of simply reporting misbehavior)

With this patch applied:

1) Ctrl-N (new document)
2) Shift-Ctrl-M (math display)
3) y^2
4) Cursor down (cursor is to the left of y but outside the scriptinset)
5) Cursor right (cursor is to the left of y but inside the scriptinset)
6) type x (now we have {xy}^2, i.e., the scriptinset nucleus is xy)
7) Cursor up (cursor is to the left of the 2)
8) Del (to delete the 2)
9) Cursor down
10) Undo

Now it goes pretty much as before, i.e., LyX spits out a long series of:

virtual MathArray& MathInset::cell(size_t): I don't have any cell

followed by an unterminated series of

InsetBase::cursorPos called directly

which only stops when clicking somewhere with the mouse. In the meantime
the cursor is blinking in the grey area below the document area.

-- 
Enrico

Reply via email to