mirror of https://github.com/helix-editor/helix
Merge 1580445e35
into 205e7ece70
commit
ee14b55f15
|
@ -24,9 +24,9 @@ pub enum IndentStyle {
|
|||
Spaces(u8),
|
||||
}
|
||||
|
||||
// 16 spaces
|
||||
const INDENTS: &str = " ";
|
||||
pub const MAX_INDENT: u8 = 16;
|
||||
// 128 spaces
|
||||
const INDENTS: &str = " ";
|
||||
pub const MAX_INDENT: u8 = 128;
|
||||
|
||||
impl IndentStyle {
|
||||
/// Creates an `IndentStyle` from an indentation string.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{auto_pairs::AutoPairs, diagnostic::Severity, Language};
|
||||
use crate::{auto_pairs::AutoPairs, diagnostic::Severity, indent::MAX_INDENT, Language};
|
||||
|
||||
use globset::GlobSet;
|
||||
use helix_stdx::rope;
|
||||
|
@ -595,12 +595,13 @@ where
|
|||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
usize::deserialize(deserializer).and_then(|n| {
|
||||
if n > 0 && n <= 16 {
|
||||
if n > 0 && n <= MAX_INDENT.into() {
|
||||
Ok(n)
|
||||
} else {
|
||||
Err(serde::de::Error::custom(
|
||||
"tab width must be a value from 1 to 16 inclusive",
|
||||
))
|
||||
Err(serde::de::Error::custom(format!(
|
||||
"tab width must be a value from 1 to {} inclusive",
|
||||
MAX_INDENT
|
||||
)))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue