]> git.lyx.org Git - lyx.git/commitdiff
Fixup 5f8959d4: keep cursor font when there was no selection
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 May 2022 21:07:10 +0000 (23:07 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 May 2022 21:10:31 +0000 (23:10 +0200)
When toggleFree is called without a selection, the only result is to
change the cursor currentfont.

In the other cases (selection or implicit selection), we want to reset
the cursor font from the text font.

Fixes bug #12518.

src/Text2.cpp

index 837bb31fc6eb739ca86e4ad41759a5fb4b9fc057..3dae072cecfa9e9132d396c16764f7f053f9dd08 100644 (file)
@@ -428,7 +428,10 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
                cur.resetAnchor();
        }
 
-       cur.setCurrentFont();
+       // 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();
 }