Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
cap character limit of title to 64 to avoid line overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatFrogDev committed Mar 18, 2024
1 parent 9f4f9e5 commit ad0e73f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,23 @@ impl Note {
println!(
"If you're done inputting a field, you can press Enter twice to continue or save, or Alt/Option-Q to return to the main menu.\r"
);

let mut name: String;
loop {
name = input("Name:", "".to_string())?;
if name.len() > 64 {
cursor_to_origin()?;
println!(
"If you're done inputting a field, you can press Enter twice to continue or save, or Alt/Option-Q to return to the main menu.\n\n\
error: The name is too long, it must be 64 characters or less.\r"
);
} else {
break;
}
}
let inputted_note = Note {
id: id,
name: input("Name:", "".to_string())?,
name: name,
content: input("Content:", "".to_string())?,
created: format!("{}", Local::now().format("%A %e %B, %H:%M")),
};
Expand Down

0 comments on commit ad0e73f

Please sign in to comment.