Skip to content
Snippets Groups Projects
Commit 2ca408fe authored by sam edelsten's avatar sam edelsten
Browse files

start glyph_index bits

parent 487f8018
No related branches found
No related tags found
No related merge requests found
...@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment