]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Fix bug #8258 (Zoom of editor doesn't zoom instant preview)
[lyx.git] / src / BufferView.cpp
index 7cb99cdf4d9cb298a2d34370e71057e14c5320ab..8a947c169fb12e30e80f6aff2bd8065a0406cd69 100644 (file)
@@ -227,7 +227,8 @@ enum ScreenUpdateStrategy {
 
 struct BufferView::Private
 {
-       Private(BufferView & bv): wh_(0), cursor_(bv),
+       Private(BufferView & bv) : update_strategy_(NoScreenUpdate),
+               wh_(0), cursor_(bv),
                anchor_pit_(0), anchor_ypos_(0),
                inlineCompletionUniqueChars_(0),
                last_inset_(0), clickable_inset_(false),
@@ -1112,13 +1113,13 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                iss >> opt;
                flag.setEnabled(opt.repl_buf_name.empty()
                                || !buffer_.isReadonly());
+               break;
        }
 
-       case LFUN_LABEL_GOTO: {
+       case LFUN_LABEL_GOTO:
                flag.setEnabled(!cmd.argument().empty()
                    || getInsetByCode<InsetRef>(cur, REF_CODE));
                break;
-       }
 
        case LFUN_CHANGES_TRACK:
                flag.setEnabled(true);
@@ -1414,20 +1415,21 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
                        b = theBufferList().next(b)) {
 
-                       DocIterator dit = b->getParFromID(id);
-                       if (dit.atEnd()) {
+                       Cursor cur(*this);
+                       cur.setCursor(b->getParFromID(id));
+                       if (cur.atEnd()) {
                                LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "].");
                                ++i;
                                continue;
                        }
-                       LYXERR(Debug::INFO, "Paragraph " << dit.paragraph().id()
+                       LYXERR(Debug::INFO, "Paragraph " << cur.paragraph().id()
                                << " found in buffer `"
                                << b->absFileName() << "'.");
 
                        if (b == &buffer_) {
                                // Set the cursor
-                               dit.pos() = pos;
-                               setCursor(dit);
+                               cur.pos() = pos;
+                               mouseSetCursor(cur);
                                dr.screenUpdate(Update::Force | Update::FitCursor);
                        } else {
                                // Switch to other buffer view and resend cmd
@@ -1746,6 +1748,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                Cursor old = cur;
                bool const in_texted = cur.inTexted();
                cur.setCursor(doc_iterator_begin(cur.buffer()));
+               if (cur != old)
+                       notifyCursorLeavesOrEnters(old, cur);
                cur.selHandle(false);
                buffer_.changed(true);
                updateHoveredInset();
@@ -2998,7 +3002,7 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
 
        // Horizontal scroll offset of the cursor row in pixels
        int offset = d->horiz_scroll_offset_;
-       int const MARGIN = Length(2, Length::EM).inPixels(workWidth());
+       int const MARGIN = Length(2, Length::EM).inPixels(pi.base);
        if (cur_x < offset + MARGIN) {
                // scroll right
                offset = cur_x - MARGIN;