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:
twanvl
2007-04-23 23:02:38 +00:00
parent 89ce208198
commit c8f5b8c4a2
4 changed files with 37 additions and 7 deletions
+15
View File
@@ -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) {
+5
View File
@@ -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.