mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-16 23:34:11 +00:00
Fix bug with how characters limits are being displayed
This commit is contained in:
parent
5c3b8a1af1
commit
8b9b19195d
1 changed files with 5 additions and 11 deletions
|
@ -256,12 +256,6 @@ impl Render for FeedbackModal {
|
||||||
};
|
};
|
||||||
|
|
||||||
let valid_character_count = FEEDBACK_CHAR_LIMIT.contains(&self.character_count);
|
let valid_character_count = FEEDBACK_CHAR_LIMIT.contains(&self.character_count);
|
||||||
let characters_remaining =
|
|
||||||
if valid_character_count || self.character_count > *FEEDBACK_CHAR_LIMIT.end() {
|
|
||||||
*FEEDBACK_CHAR_LIMIT.end() as i32 - self.character_count as i32
|
|
||||||
} else {
|
|
||||||
self.character_count as i32 - *FEEDBACK_CHAR_LIMIT.start() as i32
|
|
||||||
};
|
|
||||||
|
|
||||||
let allow_submission =
|
let allow_submission =
|
||||||
valid_character_count && valid_email_address && !self.pending_submission;
|
valid_character_count && valid_email_address && !self.pending_submission;
|
||||||
|
@ -318,14 +312,14 @@ impl Render for FeedbackModal {
|
||||||
.child(
|
.child(
|
||||||
div().child(
|
div().child(
|
||||||
Label::new(
|
Label::new(
|
||||||
if !valid_character_count && characters_remaining < 0 {
|
if self.character_count < *FEEDBACK_CHAR_LIMIT.start() {
|
||||||
"Feedback must be at least 10 characters.".to_string()
|
format!("Feedback must be at least {} characters.", FEEDBACK_CHAR_LIMIT.start())
|
||||||
} else if !valid_character_count && characters_remaining > 5000 {
|
} else if self.character_count > *FEEDBACK_CHAR_LIMIT.end() {
|
||||||
"Feedback must be less than 5000 characters.".to_string()
|
format!("Feedback must be less than {} characters.", FEEDBACK_CHAR_LIMIT.end())
|
||||||
} else {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"Characters: {}",
|
"Characters: {}",
|
||||||
characters_remaining
|
*FEEDBACK_CHAR_LIMIT.end() - self.character_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue