]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
See r37176. Let's keep this a Windows only "feature".
[lyx.git] / src / Text3.cpp
index 5079522bb47e3ab1f8aa425eeb74c68b8495ad57..20f3b6bd1ac13372d3284c874b46ec754c133a8f 100644 (file)
@@ -245,7 +245,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
                if (edit)
                        inset->edit(cur, true);
                // Now put this into inset
-               cur.text()->insertStringAsLines(cur, ds, Font(inherit_font));
+               Font const f(inherit_font, cur.current_font.language());
+               cur.text()->insertStringAsLines(cur, ds, f);
                cur.leaveInset(*inset);
                return true;
        }
@@ -467,9 +468,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        cur.noScreenUpdate();
 
        LASSERT(cur.text() == this, /**/);
-       CursorSlice oldTopSlice = cur.top();
-       bool oldBoundary = cur.boundary();
-       bool sel = cur.selection();
+       CursorSlice const oldTopSlice = cur.top();
+       bool const oldBoundary = cur.boundary();
+       bool const oldSelection = cur.selection();
        // Signals that, even if needsUpdate == false, an update of the
        // cursor paragraph is required
        bool singleParUpdate = lyxaction.funcHasFlag(cmd.action(),
@@ -477,9 +478,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        // Signals that a full-screen update is required
        bool needsUpdate = !(lyxaction.funcHasFlag(cmd.action(),
                LyXAction::NoUpdate) || singleParUpdate);
-       int const last_pid = cur.paragraph().id();
-       pos_type const last_pos = cur.pos();
-       bool const last_misspelled = lyxrc.spellcheck_continuously && cur.paragraph().isMisspelled(cur.pos());
+       bool const last_misspelled = lyxrc.spellcheck_continuously
+               && cur.paragraph().isMisspelled(cur.pos(), true);
        
        FuncCode const act = cmd.action();
        switch (act) {
@@ -1552,6 +1552,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
                cur.resetAnchor();
                moveCursor(cur, false);
+               cur.markNewWordPosition();
                bv->bookmarkEditPosition();
                break;
        }
@@ -1890,6 +1891,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                Language const * lang = languages.getLanguage(to_utf8(cmd.argument()));
                if (!lang)
                        break;
+               selectWordWhenUnderCursor(cur, WHOLE_WORD_STRICT);
                Font font(ignore_font, lang);
                toggleAndShow(cur, this, font);
                break;
@@ -2184,9 +2186,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                if (!cur.inTexted()) {
                        // move from regular text to math
                        needsUpdate = last_misspelled;
-               } else if (cur.paragraph().id() != last_pid || cur.pos() != last_pos) {
+               } else if (oldTopSlice != cur.top() || oldBoundary != cur.boundary()) {
                        // move inside regular text
-                       needsUpdate = last_misspelled || cur.paragraph().isMisspelled(cur.pos());
+                       needsUpdate = last_misspelled
+                               || cur.paragraph().isMisspelled(cur.pos(), true);
                }
        }
 
@@ -2212,7 +2215,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        if (!needsUpdate
            && &oldTopSlice.inset() == &cur.inset()
            && oldTopSlice.idx() == cur.idx()
-           && !sel // sel is a backup of cur.selection() at the beginning of the function.
+           && !oldSelection // oldSelection is a backup of cur.selection() at the beginning of the function.
            && !cur.selection())
                // FIXME: it would be better if we could just do this
                //
@@ -2373,7 +2376,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        // make sure we know about such floats
                        if (cit == floats.end() ||
                                        // and that we know how to generate a list of them
-                           (!cit->second.needsFloatPkg() && cit->second.listCommand().empty())) {
+                           (!cit->second.usesFloatPkg() && cit->second.listCommand().empty())) {
                                flag.setUnknown(true);
                                // probably not necessary, but...
                                enable = false;