Skip to content

Commit 68e717e

Browse files
committed
fix: apply the latest codes for main, terminal
1 parent 92d2d96 commit 68e717e

File tree

2 files changed

+37
-38
lines changed

2 files changed

+37
-38
lines changed

src/main.rs

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ use tokio::{
77
};
88
use tokio_util::sync::CancellationToken;
99

10-
use promkit::{
11-
crossterm::{
12-
self, cursor, execute,
13-
style::Color,
14-
terminal::{disable_raw_mode, enable_raw_mode},
15-
},
16-
listbox,
17-
style::StyleBuilder,
18-
text_editor,
10+
use promkit_core::crossterm::{
11+
self, cursor, execute,
12+
style::{Color, ContentStyle},
13+
terminal::{disable_raw_mode, enable_raw_mode},
1914
};
15+
use promkit_widgets::{listbox, text_editor};
2016

2117
mod archived;
2218
mod cmd;
@@ -125,7 +121,10 @@ async fn main() -> anyhow::Result<()> {
125121
enable_raw_mode()?;
126122
execute!(io::stdout(), cursor::Hide)?;
127123

128-
let highlight_style = StyleBuilder::new().fgc(Color::Red).build();
124+
let highlight_style = ContentStyle {
125+
foreground_color: Some(Color::Red),
126+
..Default::default()
127+
};
129128

130129
if args.archived {
131130
let (tx, mut rx) = mpsc::channel(1);
@@ -179,16 +178,16 @@ async fn main() -> anyhow::Result<()> {
179178

180179
archived::run(
181180
text_editor::State {
182-
texteditor: Default::default(),
183-
history: Default::default(),
184181
prefix: String::from("❯❯❯ "),
185-
mask: Default::default(),
186-
prefix_style: StyleBuilder::new().fgc(Color::DarkBlue).build(),
187-
active_char_style: StyleBuilder::new().bgc(Color::DarkCyan).build(),
188-
inactive_char_style: StyleBuilder::new().build(),
189-
edit_mode: Default::default(),
190-
word_break_chars: Default::default(),
191-
lines: Default::default(),
182+
prefix_style: ContentStyle {
183+
foreground_color: Some(Color::DarkBlue),
184+
..Default::default()
185+
},
186+
active_char_style: ContentStyle {
187+
background_color: Some(Color::DarkCyan),
188+
..Default::default()
189+
},
190+
..Default::default()
192191
},
193192
listbox::State {
194193
listbox: listbox::Listbox::from_displayable(queue),
@@ -205,16 +204,16 @@ async fn main() -> anyhow::Result<()> {
205204
} else {
206205
while let Ok((signal, queue)) = sig::run(
207206
text_editor::State {
208-
texteditor: Default::default(),
209-
history: Default::default(),
210207
prefix: String::from("❯❯ "),
211-
mask: Default::default(),
212-
prefix_style: StyleBuilder::new().fgc(Color::DarkGreen).build(),
213-
active_char_style: StyleBuilder::new().bgc(Color::DarkCyan).build(),
214-
inactive_char_style: StyleBuilder::new().build(),
215-
edit_mode: Default::default(),
216-
word_break_chars: Default::default(),
217-
lines: Default::default(),
208+
prefix_style: ContentStyle {
209+
foreground_color: Some(Color::DarkGreen),
210+
..Default::default()
211+
},
212+
active_char_style: ContentStyle {
213+
background_color: Some(Color::DarkCyan),
214+
..Default::default()
215+
},
216+
..Default::default()
218217
},
219218
highlight_style,
220219
Duration::from_millis(args.retrieval_timeout_millis),
@@ -236,16 +235,16 @@ async fn main() -> anyhow::Result<()> {
236235
Signal::GotoArchived => {
237236
archived::run(
238237
text_editor::State {
239-
texteditor: Default::default(),
240-
history: Default::default(),
241238
prefix: String::from("❯❯❯ "),
242-
mask: Default::default(),
243-
prefix_style: StyleBuilder::new().fgc(Color::DarkBlue).build(),
244-
active_char_style: StyleBuilder::new().bgc(Color::DarkCyan).build(),
245-
inactive_char_style: StyleBuilder::new().build(),
246-
edit_mode: Default::default(),
247-
word_break_chars: Default::default(),
248-
lines: Default::default(),
239+
prefix_style: ContentStyle {
240+
foreground_color: Some(Color::DarkBlue),
241+
..Default::default()
242+
},
243+
active_char_style: ContentStyle {
244+
background_color: Some(Color::DarkCyan),
245+
..Default::default()
246+
},
247+
..Default::default()
249248
},
250249
listbox::State {
251250
listbox: listbox::Listbox::from_displayable(queue),

src/terminal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::io::{self, Write};
22

3-
use promkit::{
3+
use promkit_core::{
44
crossterm::{self, cursor, style, terminal},
55
grapheme::StyledGraphemes,
66
pane::Pane,

0 commit comments

Comments
 (0)