>>>>> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Jean-Marc Lasgouttes wrote:
>> There is also a bug that I never filed :) Insert>File is dead
>> broken.

Juergen> In which respect?

I am glad you ask. Look at BufferView::Pimpl::MenuInsertLyXFile. There
it does
        bool const res = buffer_->readFile(fname, cursor_.pit());

Too bad! This is not going to work if we are inside an inset. Not to
difficult to fix, I guess. Then we get
        return readFile(lex, filename, pit);
which is OK, but in this method
        if (readDocument(lex)) {

So, where is the pit? Well, it's gone...

And what does Buffer::readDocument do? Basically a
        return text().read(*this, lex);

So, the first solution that occurred to me is to add a cur argument
all the way down to LyXText::read. Then I saw that this means
complicated handling of insertion in the middle of a paragraph, like
is done in pasteSelectionHelper, which I do not feel like
reimplementing...

So, another solution for MenuInsertFile would be like
* read the file in a temp buffer
* select all
* paste in current buffer
* delete temp buffer and be happy.
* optional: remove all these stupid pit arguments in Buffer::readFile.

This is probably quite easy to do, but there a couple of drawbacks
* uses more memory and clutters the clipboard
* what happens if there are errors when reading? How do we report
them?

Thanks for making me write this down :) This is now bug 2096:
http://bugzilla.lyx.org/show_bug.cgi?id=2096

JMarc

Reply via email to