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
7ceb069c
Commit
7ceb069c
authored
Mar 25, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cursor handling now correct in the precense of <sep> and <atom> (finally)
parent
be344ca6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
src/util/tagged_string.cpp
src/util/tagged_string.cpp
+18
-3
No files found.
src/util/tagged_string.cpp
View file @
7ceb069c
...
@@ -193,9 +193,6 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
...
@@ -193,9 +193,6 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
return
cursor
;
return
cursor
;
}
else
if
(
dir
==
MOVE_RIGHT
)
{
}
else
if
(
dir
==
MOVE_RIGHT
)
{
return
cursor
+
1
;
return
cursor
+
1
;
}
else
if
(
dir
==
MOVE_MID
)
{
// take the closest side
return
cursor
+
((
int
)(
after
-
index
)
<
(
int
)(
index
-
before
));
}
else
if
(
dir
==
MOVE_LEFT_OPT
)
{
}
else
if
(
dir
==
MOVE_LEFT_OPT
)
{
// is there any non-tag after index?
// is there any non-tag after index?
bool
empty
=
true
;
bool
empty
=
true
;
...
@@ -222,6 +219,22 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
...
@@ -222,6 +219,22 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
i
=
skip_tag
(
str
,
i
);
i
=
skip_tag
(
str
,
i
);
}
}
return
cursor
+
1
;
// yes it is
return
cursor
+
1
;
// yes it is
}
else
if
(
dir
==
MOVE_MID
)
{
// count number of actual characters before/after
int
before_c
=
0
;
int
after_c
=
0
;
while
(
i
<
close
)
{
c
=
str
.
GetChar
(
i
);
if
(
c
==
_
(
'<'
))
{
i
=
skip_tag
(
str
,
i
);
}
else
{
if
(
i
<
index
)
before_c
++
;
else
after_c
++
;
++
i
;
}
}
// take the closest side
return
before_c
<=
after_c
?
cursor
:
cursor
+
1
;
}
}
}
}
i
=
after
;
i
=
after
;
...
@@ -250,6 +263,8 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
...
@@ -250,6 +263,8 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
if
(
c
==
_
(
'<'
))
{
if
(
c
==
_
(
'<'
))
{
// a tag
// a tag
if
(
is_substr
(
str
,
i
,
_
(
"<atom"
))
||
is_substr
(
str
,
i
,
_
(
"<sep"
)))
{
if
(
is_substr
(
str
,
i
,
_
(
"<atom"
))
||
is_substr
(
str
,
i
,
_
(
"<sep"
)))
{
// never move the end over an atom/sep
if
(
cur
>=
cursor
)
break
;
// skip tag contents, tag counts as a single 'character'
// skip tag contents, tag counts as a single 'character'
i
=
match_close_tag_end
(
str
,
i
);
i
=
match_close_tag_end
(
str
,
i
);
}
else
{
}
else
{
...
...
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