mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-27 15:47:19 +02:00
Fix height for command window
This commit is contained in:
parent
65d128fcfb
commit
ab359ea193
1 changed files with 32 additions and 22 deletions
54
src/app.rs
54
src/app.rs
|
@ -128,56 +128,66 @@ impl App {
|
||||||
self.previous();
|
self.previous();
|
||||||
}
|
}
|
||||||
let rects = Layout::default()
|
let rects = Layout::default()
|
||||||
|
.direction(Direction::Vertical)
|
||||||
.constraints(
|
.constraints(
|
||||||
[
|
[
|
||||||
Constraint::Percentage(48),
|
Constraint::Min(0),
|
||||||
Constraint::Percentage(48),
|
Constraint::Length(3),
|
||||||
Constraint::Max(3),
|
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
)
|
)
|
||||||
.split(f.size());
|
.split(f.size());
|
||||||
self.draw_task_report(f, rects[0]);
|
let task_rects = Layout::default()
|
||||||
self.draw_task_details(f, rects[1]);
|
.direction(Direction::Vertical)
|
||||||
|
.constraints(
|
||||||
|
[
|
||||||
|
Constraint::Percentage(50),
|
||||||
|
Constraint::Percentage(50),
|
||||||
|
]
|
||||||
|
.as_ref(),
|
||||||
|
)
|
||||||
|
.split(rects[0]);
|
||||||
|
self.draw_task_report(f, task_rects[0]);
|
||||||
|
self.draw_task_details(f, task_rects[1]);
|
||||||
match self.mode {
|
match self.mode {
|
||||||
AppMode::Report => self.draw_command(f, rects[2], &self.filter[..], "Filter Tasks"),
|
AppMode::Report => self.draw_command(f, rects[1], &self.filter[..], "Filter Tasks"),
|
||||||
AppMode::Filter => {
|
AppMode::Filter => {
|
||||||
f.render_widget(Clear, rects[2]);
|
f.render_widget(Clear, rects[1]);
|
||||||
f.set_cursor(
|
f.set_cursor(
|
||||||
rects[2].x + self.filter.width() as u16 + 1,
|
rects[1].x + self.filter.width() as u16 + 1,
|
||||||
rects[2].y + 1,
|
rects[1].y + 1,
|
||||||
);
|
);
|
||||||
self.draw_command(f, rects[2], &self.filter[..], "Filter Tasks");
|
self.draw_command(f, rects[1], &self.filter[..], "Filter Tasks");
|
||||||
},
|
},
|
||||||
AppMode::ModifyTask => {
|
AppMode::ModifyTask => {
|
||||||
f.set_cursor(
|
f.set_cursor(
|
||||||
// Put cursor past the end of the input text
|
// Put cursor past the end of the input text
|
||||||
rects[2].x + self.modify.width() as u16 + 1,
|
rects[1].x + self.modify.width() as u16 + 1,
|
||||||
// Move one line down, from the border to the input line
|
// Move one line down, from the border to the input line
|
||||||
rects[2].y + 1,
|
rects[1].y + 1,
|
||||||
);
|
);
|
||||||
f.render_widget(Clear, rects[2]);
|
f.render_widget(Clear, rects[1]);
|
||||||
self.draw_command(f, rects[2], &self.modify[..], "Modify Task");
|
self.draw_command(f, rects[1], &self.modify[..], "Modify Task");
|
||||||
},
|
},
|
||||||
AppMode::LogTask => {
|
AppMode::LogTask => {
|
||||||
f.set_cursor(
|
f.set_cursor(
|
||||||
// Put cursor past the end of the input text
|
// Put cursor past the end of the input text
|
||||||
rects[2].x + self.command.width() as u16 + 1,
|
rects[1].x + self.command.width() as u16 + 1,
|
||||||
// Move one line down, from the border to the input line
|
// Move one line down, from the border to the input line
|
||||||
rects[2].y + 1,
|
rects[1].y + 1,
|
||||||
);
|
);
|
||||||
f.render_widget(Clear, rects[2]);
|
f.render_widget(Clear, rects[1]);
|
||||||
self.draw_command(f, rects[2], &self.command[..], "Log Task");
|
self.draw_command(f, rects[1], &self.command[..], "Log Task");
|
||||||
},
|
},
|
||||||
AppMode::AddTask => {
|
AppMode::AddTask => {
|
||||||
f.set_cursor(
|
f.set_cursor(
|
||||||
// Put cursor past the end of the input text
|
// Put cursor past the end of the input text
|
||||||
rects[2].x + self.command.width() as u16 + 1,
|
rects[1].x + self.command.width() as u16 + 1,
|
||||||
// Move one line down, from the border to the input line
|
// Move one line down, from the border to the input line
|
||||||
rects[2].y + 1,
|
rects[1].y + 1,
|
||||||
);
|
);
|
||||||
f.render_widget(Clear, rects[2]);
|
f.render_widget(Clear, rects[1]);
|
||||||
self.draw_command(f, rects[2], &self.command[..], "Add Task");
|
self.draw_command(f, rects[1], &self.command[..], "Add Task");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue