]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
partial fix for bug 6986: Use the right tex2lyx (at least if tex2lyx is installed)
[lyx.git] / src / BufferView.cpp
index 33d9199f2e573d8075be72ae4dfd4b28800be061..b8971fc98e02d0e1c3f7d4c5dba44e03d4cf3398 100644 (file)
@@ -308,8 +308,7 @@ BufferView::BufferView(Buffer & buf)
        d->cursor_.resetAnchor();
        d->cursor_.setCurrentFont();
 
-       if (graphics::Previews::status() != LyXRC::PREVIEW_OFF)
-               thePreviews().generateBufferPreviews(buffer_);
+       buffer_.updatePreviews();
 }
 
 
@@ -1540,8 +1539,14 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                FindAndReplaceOptions opt;
                istringstream iss(to_utf8(cmd.argument()));
                iss >> opt;
-               if (findAdv(this, opt))
+               if (findAdv(this, opt)) {
                        dr.screenUpdate(Update::Force | Update::FitCursor);
+                       cur.dispatched();
+                       dispatched = true;
+               } else {
+                       cur.undispatched();
+                       dispatched = false;
+               }
                break;
        }
 
@@ -1874,13 +1879,14 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
        }
 
        default:
-               dispatched = false;
+               // OK, so try the Buffer itself...
+               buffer_.dispatch(cmd, dr);
+               dispatched = dr.dispatched();
                break;
        }
 
        buffer_.undo().endUndoGroup();
        dr.dispatched(dispatched);
-       return;
 }
 
 
@@ -2512,8 +2518,8 @@ void BufferView::insertLyXFile(FileName const & fname)
        message(bformat(_("Inserting document %1$s..."), disp_fn));
 
        docstring res;
-       Buffer buf("", false);
-       if (buf.loadLyXFile(filename) == Buffer::ReadSuccess) {
+       Buffer buf(filename.absFileName(), false);
+       if (buf.loadLyXFile() == Buffer::ReadSuccess) {
                ErrorList & el = buffer_.errorList("Parse");
                // Copy the inserted document error list into the current buffer one.
                el = buf.errorList("Parse");
@@ -2528,7 +2534,6 @@ void BufferView::insertLyXFile(FileName const & fname)
        buffer_.changed(true);
        // emit message signal.
        message(bformat(res, disp_fn));
-       buffer_.errors("Parse");
 }
 
 
@@ -2855,6 +2860,12 @@ DocIterator const & BufferView::inlineCompletionPos() const
 }
 
 
+bool BufferView::fixInlineCompletionPos()
+{
+       return d->inlineCompletionPos_.fixIfBroken();
+}
+
+
 bool samePar(DocIterator const & a, DocIterator const & b)
 {
        if (a.empty() && b.empty())