From 99d4a63e93a5a7acb44f97e8e4eb29d929d39cc1 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 27 Jul 2018 01:19:31 +0300 Subject: [PATCH] [fbreader] Don't undo text styles that we haven't applied --- .../zlibrary/text/src/area/ZLTextAreaStyle.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fbreader/fbreader/zlibrary/text/src/area/ZLTextAreaStyle.cpp b/fbreader/fbreader/zlibrary/text/src/area/ZLTextAreaStyle.cpp index 2bab535..8b098df 100644 --- a/fbreader/fbreader/zlibrary/text/src/area/ZLTextAreaStyle.cpp +++ b/fbreader/fbreader/zlibrary/text/src/area/ZLTextAreaStyle.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus + * Copyright (C) 2018 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,14 +48,14 @@ void ZLTextArea::Style::setTextStyle(shared_ptr style, unsigned cha } void ZLTextArea::Style::applyControl(const ZLTextControlElement &control) { - if (control.isStart()) { - const ZLTextStyleDecoration *decoration = ZLTextStyleCollection::Instance().decoration(control.textKind()); - if (decoration != 0) { + const ZLTextStyleDecoration *decoration = ZLTextStyleCollection::Instance().decoration(control.textKind()); + if (decoration != 0) { + if (control.isStart()) { setTextStyle(decoration->createDecoratedStyle(myTextStyle), myBidiLevel); - } - } else { - if (myTextStyle->isDecorated()) { - setTextStyle(((ZLTextDecoratedStyle&)*myTextStyle).base(), myBidiLevel); + } else { + if (myTextStyle->isDecorated()) { + setTextStyle(((ZLTextDecoratedStyle&)*myTextStyle).base(), myBidiLevel); + } } } }