]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
Fix pasting as LaTeX in documents with no modules
[lyx.git] / src / Text2.cpp
index 66dd083d4ad6896f86152e535237609b204adb79..3dae072cecfa9e9132d396c16764f7f053f9dd08 100644 (file)
@@ -162,6 +162,7 @@ void Text::setInsetFont(BufferView const & bv, pit_type pit,
 void Text::setLayout(pit_type start, pit_type end,
                     docstring const & layout)
 {
+       // FIXME: make this work in multicell selection case
        LASSERT(start != end, return);
 
        Buffer const & buffer = owner_->buffer();
@@ -426,6 +427,11 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
                cur.top() = resetCursor;
                cur.resetAnchor();
        }
+
+       // if there was no selection at all, the point was to change cursor font.
+       // Otherwise, we want to reset it to local text font.
+       if (cur.selection() || implicitSelection)
+               cur.setCurrentFont();
 }