commit bb987c50c12e6ccdb6066a7e8a472294f12ffbba
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu May 7 15:56:22 2015 +0200
Revert correctly cursor font after undo a font toggle
The recordUndoSelection call was done after the modification of cursor
font. This is bad.
Fixes: #9537
diff --git a/src/Text2.cpp b/src/Text2.cpp
index 8f834e4..676dc1d 100644
--- a/src/Text2.cpp
+++ b/src/Text2.cpp
@@ -264,6 +264,11 @@ void Text::changeDepth(Cursor & cur, DEPTH_CHANGE type)
void Text::setFont(Cursor & cur, Font const & font, bool toggleall)
{
LASSERT(this == cur.text(), return);
+
+ // If there is a selection, record undo before the cursor font is
changed.
+ if (cur.selection())
+ cur.recordUndoSelection();
+
// Set the current_font
// Determine basis font
FontInfo layoutfont;
@@ -289,7 +294,6 @@ void Text::setFont(Cursor & cur, Font const & font, bool
toggleall)
return;
// Ok, we have a selection.
- cur.recordUndoSelection();
Font newfont = font;
if (toggleall) {