Highlight which text area is currently selected
This commit is contained in:
parent
ef90532d12
commit
61feafaf7e
@ -11,6 +11,7 @@ pub fn handle_input(state: &mut AppState) -> Result<(), std::io::Error> {
|
|||||||
if let Event::Key(key) = event::read()? {
|
if let Event::Key(key) = event::read()? {
|
||||||
match &mut state.new_task_state {
|
match &mut state.new_task_state {
|
||||||
Some(task) => {
|
Some(task) => {
|
||||||
|
// TODO: Extract this code to a separate function to avoid nesting
|
||||||
match task.focus {
|
match task.focus {
|
||||||
// TODO: Handle wrapping around the enum rather than doing it manually
|
// TODO: Handle wrapping around the enum rather than doing it manually
|
||||||
NewTaskFocus::Title => {
|
NewTaskFocus::Title => {
|
||||||
|
14
src/ui.rs
14
src/ui.rs
@ -125,9 +125,23 @@ pub fn draw_new_task_popup<B: Backend>(f: &mut Frame<B>, state: &mut AppState) {
|
|||||||
// f.render_widget(main, area);
|
// f.render_widget(main, area);
|
||||||
// f.render_widget(title, layout[0]);
|
// f.render_widget(title, layout[0]);
|
||||||
task.title.set_block(b1);
|
task.title.set_block(b1);
|
||||||
|
if let NewTaskFocus::Title = task.focus {
|
||||||
|
task.title.set_style(Style::default().fg(Color::Yellow));
|
||||||
|
task.title.set_cursor_style(Style::default().add_modifier(Modifier::REVERSED));
|
||||||
|
} else {
|
||||||
|
task.title.set_style(Style::default());
|
||||||
|
task.title.set_cursor_style(Style::default());
|
||||||
|
}
|
||||||
f.render_widget(task.title.widget(), layout[0]);
|
f.render_widget(task.title.widget(), layout[0]);
|
||||||
// f.render_widget(description, layout[1]);
|
// f.render_widget(description, layout[1]);
|
||||||
task.description.set_block(b2);
|
task.description.set_block(b2);
|
||||||
|
if let NewTaskFocus::Description = task.focus {
|
||||||
|
task.description.set_style(Style::default().fg(Color::Yellow));
|
||||||
|
task.description.set_cursor_style(Style::default().add_modifier(Modifier::REVERSED));
|
||||||
|
} else {
|
||||||
|
task.description.set_style(Style::default());
|
||||||
|
task.description.set_cursor_style(Style::default());
|
||||||
|
}
|
||||||
f.render_widget(task.description.widget(), layout[1]);
|
f.render_widget(task.description.widget(), layout[1]);
|
||||||
f.render_widget(footer, layout[2]);
|
f.render_widget(footer, layout[2]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user