Skip to content

Commit 18686db

Browse files
committed
chore!: upgrade ratatui and crosstermion to latest versions.
1 parent 967e99a commit 18686db

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ parking_lot = { version = "0.12.1", optional = true, default-features = false }
6565
log = { version = "0.4.8", optional = true }
6666

6767
# render-tui
68-
tui = { package = "ratatui", version = "0.24.0", optional = true, default-features = false }
69-
tui-react = { version = "0.21.0", optional = true }
68+
tui = { package = "ratatui", version = "0.25.0", optional = true, default-features = false }
69+
tui-react = { version = "0.22.0", optional = true }
7070
futures-core = { version = "0.3.4", optional = true, default-features = false }
7171
futures-lite = { version = "2.1.0", optional = true }
7272
humantime = { version = "2.1.0", optional = true }
7373
unicode-segmentation = { version = "1.6.0", optional = true }
7474
unicode-width = { version = "0.1.7", optional = true }
75-
crosstermion = { version = "0.12.1", optional = true, default-features = false }
75+
crosstermion = { version = "0.13.0", optional = true, default-features = false }
7676
async-io = { version = "2.2.1", optional = true }
7777

7878
# localtime support for render-tui

src/render/tui/draw/information.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn pane(lines: &[Line], bound: Rect, buf: &mut Buffer) {
3939
let blocks_drawn = draw_text_with_ellipsis_nowrap(line_bound, buf, text, bold);
4040
let lines_rect = rect::offset_x(line_bound, blocks_drawn + 1);
4141
for x in lines_rect.left()..lines_rect.right() {
42-
buf.get_mut(x, lines_rect.y).symbol = "─".into();
42+
buf.get_mut(x, lines_rect.y).set_symbol("─");
4343
}
4444
offset += 1;
4545
}

src/render/tui/engine.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ compile_error!(
9494
"Please set either the 'render-tui-crossterm' or 'render-tui-termion' feature whne using the 'render-tui'"
9595
);
9696

97+
use crosstermion::crossterm::event::{KeyCode, KeyEventKind, KeyModifiers};
9798
use crosstermion::{
9899
input::{key_input_stream, Key},
99100
terminal::{tui::new_terminal, AlternateRawScreen},
@@ -175,25 +176,32 @@ pub fn render_with_input(
175176
let mut skip_redraw = false;
176177
match event {
177178
Event::Tick => {}
178-
Event::Input(key) => match key {
179-
Key::Esc | Key::Char('q') | Key::Ctrl('c') | Key::Ctrl('[') => match interrupt_mode {
179+
Event::Input(key) if key.kind != KeyEventKind::Release => match key.code {
180+
KeyCode::Char('c') | KeyCode::Char('[') if key.modifiers.contains(KeyModifiers::CONTROL) => {
181+
match interrupt_mode {
182+
InterruptDrawInfo::Instantly => break,
183+
InterruptDrawInfo::Deferred(_) => interrupt_mode = InterruptDrawInfo::Deferred(true),
184+
}
185+
}
186+
KeyCode::Esc | KeyCode::Char('q') => match interrupt_mode {
180187
InterruptDrawInfo::Instantly => break,
181188
InterruptDrawInfo::Deferred(_) => interrupt_mode = InterruptDrawInfo::Deferred(true),
182189
},
183-
Key::Char('`') => state.hide_messages = !state.hide_messages,
184-
Key::Char('~') => state.messages_fullscreen = !state.messages_fullscreen,
185-
Key::Char('J') => state.message_offset = state.message_offset.saturating_add(1),
186-
Key::Char('D') => state.message_offset = state.message_offset.saturating_add(10),
187-
Key::Char('j') => state.task_offset = state.task_offset.saturating_add(1),
188-
Key::Char('d') => state.task_offset = state.task_offset.saturating_add(10),
189-
Key::Char('K') => state.message_offset = state.message_offset.saturating_sub(1),
190-
Key::Char('U') => state.message_offset = state.message_offset.saturating_sub(10),
191-
Key::Char('k') => state.task_offset = state.task_offset.saturating_sub(1),
192-
Key::Char('u') => state.task_offset = state.task_offset.saturating_sub(10),
193-
Key::Char('[') => state.hide_info = !state.hide_info,
194-
Key::Char('{') => state.maximize_info = !state.maximize_info,
190+
KeyCode::Char('`') => state.hide_messages = !state.hide_messages,
191+
KeyCode::Char('~') => state.messages_fullscreen = !state.messages_fullscreen,
192+
KeyCode::Char('J') => state.message_offset = state.message_offset.saturating_add(1),
193+
KeyCode::Char('D') => state.message_offset = state.message_offset.saturating_add(10),
194+
KeyCode::Char('j') => state.task_offset = state.task_offset.saturating_add(1),
195+
KeyCode::Char('d') => state.task_offset = state.task_offset.saturating_add(10),
196+
KeyCode::Char('K') => state.message_offset = state.message_offset.saturating_sub(1),
197+
KeyCode::Char('U') => state.message_offset = state.message_offset.saturating_sub(10),
198+
KeyCode::Char('k') => state.task_offset = state.task_offset.saturating_sub(1),
199+
KeyCode::Char('u') => state.task_offset = state.task_offset.saturating_sub(10),
200+
KeyCode::Char('[') => state.hide_info = !state.hide_info,
201+
KeyCode::Char('{') => state.maximize_info = !state.maximize_info,
195202
_ => skip_redraw = true,
196203
},
204+
Event::Input(_) => skip_redraw = true,
197205
Event::SetWindowSize(bound) => state.user_provided_window_size = Some(bound),
198206
Event::SetTitle(title) => state.title = title,
199207
Event::SetInformation(info) => state.information = info,

0 commit comments

Comments
 (0)