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
3583a8f5
Commit
3583a8f5
authored
Dec 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct selection drawing, fixed cursor position around <line>
parent
cfd59072
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
src/gui/value/text.cpp
src/gui/value/text.cpp
+1
-1
src/util/tagged_string.cpp
src/util/tagged_string.cpp
+20
-8
No files found.
src/gui/value/text.cpp
View file @
3583a8f5
...
@@ -509,7 +509,7 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
...
@@ -509,7 +509,7 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
// editor.refreshEditor();
// editor.refreshEditor();
// } else {
// } else {
// draw new selection
// draw new selection
v
.
drawSelection
(
rdc
,
style
(),
selection_start
,
selection_end
);
v
.
drawSelection
(
rdc
,
style
(),
selection_start
_i
,
selection_end_i
);
// }
// }
showCaret
();
showCaret
();
// TODO; DEBUG!!
// TODO; DEBUG!!
...
...
src/util/tagged_string.cpp
View file @
3583a8f5
...
@@ -169,22 +169,29 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
...
@@ -169,22 +169,29 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
// after the loop, cursor corresponds to index end
// after the loop, cursor corresponds to index end
for
(
size_t
i
=
0
;
i
<
str
.
size
()
;
)
{
for
(
size_t
i
=
0
;
i
<
str
.
size
()
;
)
{
Char
c
=
str
.
GetChar
(
i
);
Char
c
=
str
.
GetChar
(
i
);
bool
has_width
=
true
;
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"
)))
{
// skip tag contents, tag counts as a single 'character'
// skip tag contents, tag counts as a single 'character'
i
=
skip_tag
(
str
,
match_close_tag
(
str
,
i
));
i
=
skip_tag
(
str
,
match_close_tag
(
str
,
i
));
cursor
++
;
}
else
if
(
is_substr
(
str
,
i
,
_
(
"<line"
)))
{
start
=
end
;
// no contents, but has width
end
=
i
;
i
=
skip_tag
(
str
,
i
);
if
(
end
>
index
)
break
;
if
(
i
>
index
)
{
// HACK: Don't walk past <line>
dir
=
dir
==
MOVE_RIGHT
?
MOVE_LEFT
:
MOVE_RIGHT
;
}
}
else
{
}
else
{
i
=
skip_tag
(
str
,
i
);
i
=
skip_tag
(
str
,
i
);
end
=
i
;
end
=
i
;
has_width
=
false
;
}
}
}
else
{
}
else
{
cursor
++
;
i
++
;
i
++
;
}
if
(
has_width
)
{
cursor
++
;
start
=
end
;
start
=
end
;
end
=
i
;
end
=
i
;
if
(
end
>
index
)
break
;
if
(
end
>
index
)
break
;
...
@@ -204,19 +211,24 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
...
@@ -204,19 +211,24 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
size_t
i
=
0
;
size_t
i
=
0
;
while
(
cur
<=
cursor
&&
i
<
str
.
size
())
{
while
(
cur
<=
cursor
&&
i
<
str
.
size
())
{
Char
c
=
str
.
GetChar
(
i
);
Char
c
=
str
.
GetChar
(
i
);
bool
has_width
=
true
;
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"
)))
{
// skip tag contents, tag counts as a single 'character'
// skip tag contents, tag counts as a single 'character'
i
=
skip_tag
(
str
,
match_close_tag
(
str
,
i
));
i
=
skip_tag
(
str
,
match_close_tag
(
str
,
i
));
cur
++
;
}
else
if
(
is_substr
(
str
,
i
,
_
(
"<line"
)))
{
if
(
cur
==
cursor
)
start
=
i
;
// no contents, but has width
i
=
skip_tag
(
str
,
i
);
}
else
{
}
else
{
i
=
skip_tag
(
str
,
i
);
i
=
skip_tag
(
str
,
i
);
has_width
=
false
;
}
}
}
else
{
}
else
{
cur
++
;
i
++
;
i
++
;
}
if
(
has_width
)
{
cur
++
;
if
(
cur
==
cursor
)
start
=
i
;
if
(
cur
==
cursor
)
start
=
i
;
}
}
}
}
...
...
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