Remove Pre tag when removing Code tag.

This commit is contained in:
John Preston 2022-05-23 12:38:42 +04:00
parent c25c3e043c
commit 3668ee1085

View file

@ -3312,8 +3312,16 @@ void InputField::removeMarkdownTag(
auto tags = TagList();
for (const auto &existing : current.tags) {
const auto id = TextUtilities::TagWithRemoved(existing.id, tag);
if (!id.isEmpty()) {
tags.push_back({ existing.offset, existing.length, id });
const auto additional = (tag == kTagPre)
? kTagCode
: (tag == kTagCode)
? kTagPre
: QString();
const auto use = additional.isEmpty()
? id
: TextUtilities::TagWithRemoved(id, additional);
if (!use.isEmpty()) {
tags.push_back({ existing.offset, existing.length, use });
}
}