mirror of
https://github.com/wez/wezterm.git
synced 2024-12-28 07:55:03 +03:00
validate the config to prevent div by 0 for initial_cols/initial_rows
refs: https://github.com/wez/wezterm/issues/2593
This commit is contained in:
parent
0e98b23392
commit
fa4fced599
@ -181,7 +181,7 @@ pub struct Config {
|
||||
pub set_environment_variables: HashMap<String, String>,
|
||||
|
||||
/// Specifies the height of a new window, expressed in character cells.
|
||||
#[dynamic(default = "default_initial_rows")]
|
||||
#[dynamic(default = "default_initial_rows", validate = "validate_row_or_col")]
|
||||
pub initial_rows: u16,
|
||||
|
||||
#[dynamic(default = "default_true")]
|
||||
@ -190,7 +190,7 @@ pub struct Config {
|
||||
pub enable_kitty_keyboard: bool,
|
||||
|
||||
/// Specifies the width of a new window, expressed in character cells
|
||||
#[dynamic(default = "default_initial_cols")]
|
||||
#[dynamic(default = "default_initial_cols", validate = "validate_row_or_col")]
|
||||
pub initial_cols: u16,
|
||||
|
||||
#[dynamic(default = "default_hyperlink_rules")]
|
||||
@ -1656,6 +1656,14 @@ impl Default for ImePreeditRendering {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_row_or_col(value: u16) -> Result<(), String> {
|
||||
if value < 1 {
|
||||
Err("initial_cols and initial_rows must be non-zero".to_string())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_line_height(value: f64) -> Result<(), String> {
|
||||
if value <= 0.0 {
|
||||
Err(format!(
|
||||
|
@ -66,6 +66,8 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
[#2548](https://github.com/wez/wezterm/issues/2548)
|
||||
* CharSelect panic when pressing enter when no matches were found
|
||||
[#2580](https://github.com/wez/wezterm/issues/2580)
|
||||
* Panic when setting `initial_rows` or `initial_cols` to `0`
|
||||
[2593](https://github.com/wez/wezterm/issues/2593)
|
||||
|
||||
#### Changed
|
||||
* Removed Last Resort fallback font
|
||||
|
Loading…
Reference in New Issue
Block a user