mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
in_tag function now looks for a positive number of tag occurrences.
In particular: in "<tag><tag></tag>x</tag>" the x is now in_tag. This fixes the rest of #20. Also added is_in_tag function that returns a bool instead of the tag position. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1456 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -140,8 +140,7 @@ TextValueAction* toggle_format_action(const TextValueP& value, const String& tag
|
||||
String new_value;
|
||||
const String& str = value->value();
|
||||
// Are we inside the tag we are toggling?
|
||||
size_t tagpos = in_tag(str, _("<") + tag, start_i, end_i);
|
||||
if (tagpos == String::npos) {
|
||||
if (!is_in_tag(str, _("<") + tag, start_i, end_i)) {
|
||||
// we are not inside this tag, add it
|
||||
new_value = str.substr(0, start_i);
|
||||
new_value += _("<") + tag + _(">");
|
||||
|
||||
Reference in New Issue
Block a user