Skip to content

Commit e73c8b0

Browse files
committed
Reduce KeyPress duplication in text_editor
1 parent 28d8b73 commit e73c8b0

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

widget/src/text_editor.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,20 +1017,17 @@ impl<Message> Update<Message> {
10171017
Status::Active
10181018
};
10191019

1020+
let key_press = KeyPress {
1021+
key,
1022+
modifiers,
1023+
text,
1024+
status,
1025+
};
1026+
10201027
if let Some(key_binding) = key_binding {
1021-
key_binding(KeyPress {
1022-
key,
1023-
modifiers,
1024-
text,
1025-
status,
1026-
})
1028+
key_binding(key_press)
10271029
} else {
1028-
Binding::from_key_press(KeyPress {
1029-
key,
1030-
modifiers,
1031-
text,
1032-
status,
1033-
})
1030+
Binding::from_key_press(key_press)
10341031
}
10351032
.map(Self::Binding)
10361033
}

0 commit comments

Comments
 (0)