use ui::input::{self, Shape, TextField};
const COMPOSER: &str = "Composer";
cx.bind_keys([
KeyBinding::new("enter", Send, Some(COMPOSER)),
KeyBinding::new("shift-enter", input::InsertNewline, Some(COMPOSER)),
]);
let composer = cx.new(|cx| {
TextField::new(cx)
.with_shape(Shape::Grow { min: 3, max: 12 })
.with_key_context(COMPOSER)
});Shape::Fillis as tall as its parent, which must give it a definite height.- Rebind
enteron a context of the field's own (with_key_context). Rebindinginput::MULTILINE_KEY_CONTEXTtakes the newline from every textarea in the app.