Skip to content

Commit 2842772

Browse files
committed
use pre-inserted text instead of default for edit command
1 parent 6451455 commit 2842772

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/commands/edit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::Command;
22
use crate::{
33
config::Config,
44
store::{Entry, Store},
5-
util::{parse_date, select_date, FormatableEntry},
5+
util::{FormatableEntry, parse_date, select_date},
66
};
77
use anyhow::Result;
88
use chrono::{Local, NaiveDateTime, NaiveTime};
@@ -65,14 +65,14 @@ impl Command for Edit {
6565
.with_parser(&parse_time)
6666
.with_formatter(&format_time)
6767
.with_default_value_formatter(&format_time)
68-
.with_default(selected.timestamp.time())
68+
.with_starting_input(&format_time(selected.timestamp.time()))
6969
.with_error_message("Invalid value. Must be time i nformat %H:%M")
7070
.prompt()?;
7171

7272
let timestamp = NaiveDateTime::new(selected.timestamp.date(), time);
7373

7474
let message = Text::new("Message")
75-
.with_default(&selected.message)
75+
.with_initial_value(&selected.message)
7676
.prompt()?;
7777

7878
let long = Editor::new("Long")

0 commit comments

Comments
 (0)