Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Bevy Cosmic Edit
Commits
2ca408fe
Commit
2ca408fe
authored
1 year ago
by
sam edelsten
Browse files
Options
Downloads
Patches
Plain Diff
start glyph_index bits
parent
487f8018
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/render.rs
+14
-3
14 additions, 3 deletions
src/render.rs
with
14 additions
and
3 deletions
src/render.rs
+
14
−
3
View file @
2ca408fe
...
@@ -500,7 +500,7 @@ pub(crate) fn update_handle_sprite(
...
@@ -500,7 +500,7 @@ pub(crate) fn update_handle_sprite(
}
}
#[derive(Resource,
Default)]
#[derive(Resource,
Default)]
pub
(
crate
)
struct
PasswordStates
(
pub
HashMap
<
Entity
,
String
>
);
pub
(
crate
)
struct
PasswordStates
(
pub
HashMap
<
Entity
,
(
String
,
usize
)
>
);
pub
(
crate
)
fn
hide_password_text
(
pub
(
crate
)
fn
hide_password_text
(
mut
editor_q
:
Query
<
(
Entity
,
&
mut
CosmicEditor
,
&
CosmicAttrs
,
&
PasswordInput
)
>
,
mut
editor_q
:
Query
<
(
Entity
,
&
mut
CosmicEditor
,
&
CosmicAttrs
,
&
PasswordInput
)
>
,
...
@@ -537,11 +537,22 @@ pub(crate) fn hide_password_text(
...
@@ -537,11 +537,22 @@ pub(crate) fn hide_password_text(
cursor
.index
*=
char_len
;
cursor
.index
*=
char_len
;
if
cosmic_editor
.0
.buffer
()
.lines
[
0
]
.layout_opt
()
.is_some
()
{
let
lc
=
cosmic_editor
.0
.buffer
()
.layout_cursor
(
&
cursor
);
println!
(
"{:?}"
,
lc
.glyph
);
}
cosmic_editor
.0
.set_select_opt
(
select_opt
);
cosmic_editor
.0
.set_select_opt
(
select_opt
);
cosmic_editor
.0
.set_cursor
(
cursor
);
cosmic_editor
.0
.set_cursor
(
cursor
);
}
}
password_input_states
.0
.insert
(
entity
,
text
);
let
glyph_idx
=
match
cosmic_editor
.0
.buffer
()
.lines
[
0
]
.layout_opt
()
{
Some
(
_
)
=>
cosmic_editor
.0
.buffer
()
.layout_cursor
(
&
cursor
)
.glyph
,
None
=>
0
,
};
password_input_states
.0
.insert
(
entity
,
(
text
,
glyph_idx
));
}
}
}
}
...
@@ -551,7 +562,7 @@ pub(crate) fn restore_password_text(
...
@@ -551,7 +562,7 @@ pub(crate) fn restore_password_text(
password_input_states
:
Res
<
PasswordStates
>
,
password_input_states
:
Res
<
PasswordStates
>
,
)
{
)
{
for
(
entity
,
mut
cosmic_editor
,
attrs
,
password
)
in
editor_q
.iter_mut
()
{
for
(
entity
,
mut
cosmic_editor
,
attrs
,
password
)
in
editor_q
.iter_mut
()
{
if
let
Some
(
text
)
=
password_input_states
.0
.get
(
&
entity
)
{
if
let
Some
(
(
text
,
_glyph_idx
)
)
=
password_input_states
.0
.get
(
&
entity
)
{
// reset intercepted text
// reset intercepted text
if
!
text
.is_empty
()
{
if
!
text
.is_empty
()
{
let
char_len
=
password
.0
.len_utf8
();
let
char_len
=
password
.0
.len_utf8
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment