aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorTornaxO72023-12-15 18:05:04 +0000
committerGitHub2023-12-15 18:05:04 +0000
commit914c83420b9901f596bf771ad5f20495de9a070c (patch)
tree0437b4028945e74ce3f692d429cf9238433bde17 /helix-term/src
parent33d85606cf36da074d91db498d12233ab4978509 (diff)
fix `:indent-style` crash (#9087)
* removing unreachable statement in `:indent-style` * update checks when setting indent line and update docs * `cargo xtask docgen`
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands/typed.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 4148257f..1d4d6505 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -6,6 +6,7 @@ use crate::job::Job;
use super::*;
use helix_core::fuzzy::fuzzy_match;
+use helix_core::indent::MAX_INDENT;
use helix_core::{encoding, line_ending, path::get_canonicalized_path, shellwords::Shellwords};
use helix_lsp::{OffsetEncoding, Url};
use helix_view::document::DEFAULT_LANGUAGE_NAME;
@@ -476,8 +477,7 @@ fn set_indent_style(
cx.editor.set_status(match style {
Tabs => "tabs".to_owned(),
Spaces(1) => "1 space".to_owned(),
- Spaces(n) if (2..=8).contains(&n) => format!("{} spaces", n),
- _ => unreachable!(), // Shouldn't happen.
+ Spaces(n) => format!("{} spaces", n),
});
return Ok(());
}
@@ -489,7 +489,7 @@ fn set_indent_style(
Some(arg) => arg
.parse::<u8>()
.ok()
- .filter(|n| (1..=8).contains(n))
+ .filter(|n| (1..=MAX_INDENT).contains(n))
.map(Spaces),
_ => None,
};
@@ -2606,7 +2606,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
TypableCommand {
name: "indent-style",
aliases: &[],
- doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
+ doc: "Set the indentation style for editing. ('t' for tabs or 1-16 for number of spaces.)",
fun: set_indent_style,
signature: CommandSignature::none(),
},