Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ documentation = "https://docs.rs/cursive-tabs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cursive_core = "0.3"
cursive_core = "0.4"
crossbeam = "0.8"
log = "0.4"
num = "0.4"

[dev-dependencies]
serde_json = "1.0.74"
cursive = "0.17.0"
cursive = "0.21.0"
insta = "1.10.0"
23 changes: 16 additions & 7 deletions src/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,22 @@ impl View for TabPanel {
}

fn on_event(&mut self, evt: Event) -> EventResult {
let result = self.check_focus_grab(&evt);

result.and(if self.bar_focused {
self.on_event_focused(evt)
} else {
self.on_event_unfocused(evt)
})
match evt {
Event::Refresh => {
self.tabs.on_event(Event::Refresh);
self.bar.on_event(Event::Refresh);
EventResult::Consumed(None)
}
_ => {
let result = self.check_focus_grab(&evt);

result.and(if self.bar_focused {
self.on_event_focused(evt)
} else {
self.on_event_unfocused(evt)
})
}
}
}

fn take_focus(&mut self, d: Direction) -> Result<EventResult, CannotFocus> {
Expand Down
50 changes: 25 additions & 25 deletions tests/snapshots/end2end__end2end_add_at_action_change_tab.snap
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
source: tests/end2end.rs
assertion_line: 107
expression: tsiv.last_screen()
---
captured piece:
x01234567890123456789012345678901234567890123456789012345678901234567890123456789x
0................................................................................|
1................................................................................|
2................................................................................|
3................................................................................|
4................................................................................|
5................................................................................|
6................................................................................|
7................................................................................|
8................................................................................|
9................................................................................|
0................................................................................|
1.....................................Second.....................................|
2...................................... ....................................|
3................................................................................|
4................................................................................|
5................................................................................|
6................................................................................|
7................................................................................|
8................................................................................|
9................................................................................|
0................................................................................|
1................................................................................|
2................................................................................|
3................................................................................|
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
0 |
1 Second |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
0 |
1 |
2 |
3 |
x--------------------------------------------------------------------------------x

Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
source: tests/end2end.rs
assertion_line: 215
expression: tsiv.last_screen()
---
captured piece:
x01234567890123456789012345678901234567890123456789012345678901234567890123456789x
0................................................................................|
1................................................................................|
2................................................................................|
3................................................................................|
4................................................................................|
5................................................................................|
6................................................................................|
7................................................................................|
8............................. ┌─────┐..............................|
9............................. ━━━━━━━━━━━━━Pshhh│ .............................|
0............................. Stronk test h │ .............................|
1.............................━━━━━━━━━━━━━━━ │ .............................|
2............................. Stronker test │ .............................|
3.............................──────────────┬ │ .............................|
4............................. └─────┘ .............................|
5.............................. .............................|
6................................................................................|
7................................................................................|
8................................................................................|
9................................................................................|
0................................................................................|
1................................................................................|
2................................................................................|
3................................................................................|
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 ┌─────┐ |
9 ━━━━━━━━━━━━━Pshhh│ |
0 Stronk test h │ |
1 ━━━━━━━━━━━━━━━ │ |
2 Stronker test │ |
3 ──────────────┬ │ |
4 └─────┘ |
5 |
6 |
7 |
8 |
9 |
0 |
1 |
2 |
3 |
x--------------------------------------------------------------------------------x