[fbreader] Don't undo text styles that we haven't applied

This commit is contained in:
Slava Monich 2018-07-27 01:19:31 +03:00
parent 139460734b
commit 99d4a63e93

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com> * Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
* Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -47,14 +48,14 @@ void ZLTextArea::Style::setTextStyle(shared_ptr<ZLTextStyle> style, unsigned cha
} }
void ZLTextArea::Style::applyControl(const ZLTextControlElement &control) { void ZLTextArea::Style::applyControl(const ZLTextControlElement &control) {
if (control.isStart()) { const ZLTextStyleDecoration *decoration = ZLTextStyleCollection::Instance().decoration(control.textKind());
const ZLTextStyleDecoration *decoration = ZLTextStyleCollection::Instance().decoration(control.textKind()); if (decoration != 0) {
if (decoration != 0) { if (control.isStart()) {
setTextStyle(decoration->createDecoratedStyle(myTextStyle), myBidiLevel); setTextStyle(decoration->createDecoratedStyle(myTextStyle), myBidiLevel);
} } else {
} else { if (myTextStyle->isDecorated()) {
if (myTextStyle->isDecorated()) { setTextStyle(((ZLTextDecoratedStyle&)*myTextStyle).base(), myBidiLevel);
setTextStyle(((ZLTextDecoratedStyle&)*myTextStyle).base(), myBidiLevel); }
} }
} }
} }