Handle a "modifier+bare key" key combination
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 270
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 2
Description
### Description
Cannot process a "modifier+bare key" key combination, only a "bare key".
### Configuration
```sh
$ uname -srm
Linux 4.2.0-42-generic x86_64
$ rustc --version
rustc 1.18.0 (03fc9d622 2017-06-06)
$ gnome-terminal --version
GNOME Terminal 3.6.2
```
Cursive version 0.6.4, the issue is relevant to all backends except BearLibTerminal which I didn't test.
### Expected behaviour
Print on the upper-left corner:
- `ctrl+enter` on Ctrl+Enter;
- `shift+enter` on Shift+Enter;
- `alt+enter` on Alt+Enter.
### Actual behaviour
Nothing happens.
### Code to reproduce
```rust
extern crate cursive;
use cursive::{Cursive, Printer};
use cursive::event::{Event, EventResult, Key};
use cursive::vec::Vec2;
use cursive::view::View;
struct Foo {
info: &'static str,
}
impl View for Foo {
fn draw(&self, printer: &Printer) {
printer.print((0, 0), self.info);
}
fn required_size(&mut self, constraint: Vec2) -> Vec2 {
Vec2::from((self.info.len(), 1)).or_min(constraint)
}
fn on_event(&mut self, event: Event) -> EventResult {
self.info = match event {
//Event::Key(Key::Enter) => "enter",
Event::Ctrl(Key::Enter) => "ctrl+enter",
Event::Shift(Key::Enter) => "shift+enter",
Event::Alt(Key::Enter) => "alt+enter",
_ => return EventResult::Ignored,
};
EventResult::Consumed(None)
}
}
fn main() {
let mut siv = Cursive::new();
siv.add_fullscreen_layer(Foo { info: "" });
siv.run();
}
```
P.S. If the `Event::Key(Key::Enter) => "enter"` part is uncommented, the program will print `enter ` for all 4 cases.
UPD: Add gnome-terminal as the terminal used and its version.
Contributor guide
Assessment
This issue has not been assessed yet.