mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
find/replace working better (but not done yet)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@300 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -329,6 +329,21 @@ size_t untagged_to_index(const String& str, size_t pos, bool inside) {
|
||||
return i;
|
||||
}
|
||||
|
||||
size_t index_to_untagged(const String& str, size_t index) {
|
||||
size_t i = 0, p = 0;
|
||||
index = min(str.size(), index);
|
||||
while (i < index) {
|
||||
Char c = str.GetChar(i);
|
||||
if (c == _('<')) {
|
||||
i = skip_tag(str, i);
|
||||
} else {
|
||||
i++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Global operations
|
||||
|
||||
String remove_tag(const String& str, const String& tag) {
|
||||
|
||||
@@ -119,6 +119,11 @@ size_t cursor_to_index(const String& str, size_t cursor, Movement dir = MOVE_MID
|
||||
*/
|
||||
size_t untagged_to_index(const String& str, size_t pos, bool inside);
|
||||
|
||||
/// Find the untagged position corresponding to the given tagged position.
|
||||
/** An untagged position in str is a position in untag(str).
|
||||
*/
|
||||
size_t index_to_untagged(const String& str, size_t index);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Global operations
|
||||
|
||||
/// Remove all instances of a tag and its close tag, but keep the contents.
|
||||
|
||||
Reference in New Issue
Block a user