forked from kageru/tracc
parent
233e4ebb29
commit
17f683e0d3
@ -83,8 +83,8 @@ impl TimeSheet {
|
||||
*/
|
||||
pub fn shift_current(&mut self, minutes: i64) {
|
||||
let time = &mut self.times[self.selected].time;
|
||||
let current_minute = time.minute() as i64;
|
||||
*time += Duration::minutes(minutes - current_minute % minutes);
|
||||
*time += Duration::minutes(minutes);
|
||||
*time -= Duration::minutes(time.minute() as i64 % 5)
|
||||
}
|
||||
|
||||
fn current(&self) -> &TimePoint {
|
||||
|
@ -69,7 +69,10 @@ impl Tracc {
|
||||
}
|
||||
Key::Char('a') | Key::Char('A') => self.set_mode(Mode::Insert)?,
|
||||
Key::Char(' ') if self.focus == Focus::Top => self.todos.toggle_current(),
|
||||
Key::Char('-') if self.focus == Focus::Bottom => self.times.shift_current(-5),
|
||||
// Subtract only 1 minute because the number is truncated to the next multiple
|
||||
// of 5 afterwards, so this is effectively a -5.
|
||||
// See https://git.kageru.moe/kageru/tracc/issues/8
|
||||
Key::Char('-') if self.focus == Focus::Bottom => self.times.shift_current(-1),
|
||||
Key::Char('+') if self.focus == Focus::Bottom => self.times.shift_current(5),
|
||||
// dd
|
||||
Key::Char('d') => {
|
||||
|
Loading…
Reference in New Issue
Block a user