mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fix bug with adding multiple tags at once
This commit is contained in:
@@ -119,14 +119,20 @@ unique_ptr<TextValueAction> toggle_format_action(const TextValueP& value, vector
|
||||
tag == _("li") ? compute_new_bullet_value (new_value, offset, start_i, end_i):
|
||||
compute_new_simple_value (new_value, tag, start_i, end_i);
|
||||
// Erase redundant tags
|
||||
if (start != end) {
|
||||
// don't simplify if start == end, this way we insert <b></b>, allowing the
|
||||
// user to press Ctrl+B and start typing bold text
|
||||
new_value = simplify_tagged(new_value);
|
||||
if (start != end) {
|
||||
// Simplify
|
||||
new_value = simplify_tagged(new_value);
|
||||
// Adjust selection
|
||||
start_i = to_tagged_pos(new_value, untagged_start_i, true, true, true);
|
||||
end_i = to_tagged_pos(new_value, untagged_end_i, false, false, false);
|
||||
}
|
||||
else {
|
||||
// Don't simplify if start == end, this way we insert <b></b>,
|
||||
// allowing the user to press Ctrl+B and start typing bold text
|
||||
// Adjust selection
|
||||
start_i = to_tagged_pos(new_value, untagged_start_i, true, false, true);
|
||||
end_i = to_tagged_pos(new_value, untagged_end_i, true, false, true);
|
||||
}
|
||||
// Adjust selection
|
||||
start_i = to_tagged_pos(new_value, untagged_start_i, true, false);
|
||||
end_i = to_tagged_pos(new_value, untagged_end_i, true, false);
|
||||
}
|
||||
// Build action
|
||||
if (value->value() == new_value) {
|
||||
|
||||
Reference in New Issue
Block a user