Skip to content

Commit

Permalink
#394 #443 Fix cursor moving to text field start when entering it
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Sep 16, 2021
1 parent e581fa0 commit 141dbfd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main/src/infrastructure/ui/mapping_header_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,15 +636,19 @@ impl View for MappingHeaderPanel {
true
}

fn edit_control_focus_killed(self: SharedView<Self>, _resource_id: u32) -> bool {
fn edit_control_focus_killed(self: SharedView<Self>, resource_id: u32) -> bool {
// This is also called when the window is hidden.
// The edit control which is currently edited by the user doesn't get invalidated during
// `edit_control_changed()`, for good reasons. But as soon as the edit control loses
// focus, we should invalidate it. This is especially important if the user
// entered an invalid value. Because we are lazy and edit controls are not
// manipulated very frequently, we just invalidate all controls.
// If this fails (because the mapping is not filled anymore), it's not a problem.
self.with_item_if_set(Self::invalidate_controls_internal);
self.with_item_if_set(|s, item| match resource_id {
root::ID_MAPPING_NAME_EDIT_CONTROL => s.invalidate_name_edit_control(item, None),
root::ID_MAPPING_TAGS_EDIT_CONTROL => s.invalidate_tags_edit_control(item, None),
_ => {}
});
false
}
}
Expand Down

0 comments on commit 141dbfd

Please sign in to comment.