Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
faeb0888
Commit
faeb0888
authored
Dec 24, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MOVE_MID support for cursor_to_index
parent
c24b5bd3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
src/util/tagged_string.cpp
src/util/tagged_string.cpp
+19
-1
No files found.
src/util/tagged_string.cpp
View file @
faeb0888
...
@@ -232,7 +232,25 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
...
@@ -232,7 +232,25 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
size_t
cursor_to_index
(
const
String
&
str
,
size_t
cursor
,
Movement
dir
)
{
size_t
cursor_to_index
(
const
String
&
str
,
size_t
cursor
,
Movement
dir
)
{
size_t
start
,
end
;
size_t
start
,
end
;
cursor_to_index_range
(
str
,
cursor
,
start
,
end
);
cursor_to_index_range
(
str
,
cursor
,
start
,
end
);
// TODO: If at i there is <tag></tag> return a position inside the tags
if
(
dir
==
MOVE_MID
)
{
// find the middle between start and end
// if the string in between contains a pair "<tag></tag>" or "</tag><tag>" returns the middle
// otherwise returns start
for
(
size_t
i
=
start
;
i
<
end
;
)
{
if
(
str
.
GetChar
(
i
)
==
_
(
'<'
))
{
String
tag1
=
tag_at
(
str
,
i
);
i
=
skip_tag
(
str
,
i
);
if
(
str
.
GetChar
(
i
)
==
_
(
'<'
))
{
String
tag2
=
tag_at
(
str
,
i
);
if
(
_
(
"<"
)
+
tag2
+
_
(
">"
)
==
anti_tag
(
tag1
))
{
return
i
;
}
}
}
else
{
i
++
;
}
}
}
// This allows formating to be enabled without a selection
// This allows formating to be enabled without a selection
return
dir
==
MOVE_RIGHT
?
end
-
1
:
start
;
return
dir
==
MOVE_RIGHT
?
end
-
1
:
start
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment