aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/Cargo.toml2
-rw-r--r--helix-term/src/commands.rs16
-rw-r--r--helix-term/src/commands/lsp.rs2
3 files changed, 13 insertions, 7 deletions
diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml
index 378f25f8..672e6f84 100644
--- a/helix-term/Cargo.toml
+++ b/helix-term/Cargo.toml
@@ -10,7 +10,7 @@ repository = "https://github.com/helix-editor/helix"
homepage = "https://helix-editor.com"
include = ["src/**/*", "README.md"]
default-run = "hx"
-rust-version = "1.65"
+rust-version = "1.70"
[features]
default = ["git"]
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index bc54abaa..cd053266 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1318,7 +1318,7 @@ fn extend_next_long_word_end(cx: &mut Context) {
extend_word_impl(cx, movement::move_next_long_word_end)
}
-/// Separate branch to find_char designed only for <ret> char.
+/// Separate branch to find_char designed only for `<ret>` char.
//
// This is necessary because the one document can have different line endings inside. And we
// cannot predict what character to find when <ret> is pressed. On the current line it can be `lf`
@@ -5606,12 +5606,18 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
};
// These `usize`s cannot underflow because selection ranges cannot overlap.
- // Once the MSRV is 1.66.0 (mixed_integer_ops is stabilized), we can use checked
- // arithmetic to assert this.
- let anchor = (to as isize + offset - deleted_len as isize) as usize;
+ let anchor = to
+ .checked_add_signed(offset)
+ .expect("Selection ranges cannot overlap")
+ .checked_sub(deleted_len)
+ .expect("Selection ranges cannot overlap");
let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction());
ranges.push(new_range);
- offset = offset + output_len as isize - deleted_len as isize;
+ offset = offset
+ .checked_add_unsigned(output_len)
+ .expect("Selection ranges cannot overlap")
+ .checked_sub_unsigned(deleted_len)
+ .expect("Selection ranges cannot overlap");
changes.push((from, to, Some(output)));
}
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 57be1267..87400461 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -49,7 +49,7 @@ use std::{
/// If there is no configured language server that supports the feature, this displays a status message.
/// Using this macro in a context where the editor automatically queries the LSP
/// (instead of when the user explicitly does so via a keybind like `gd`)
-/// will spam the "No configured language server supports <feature>" status message confusingly.
+/// will spam the "No configured language server supports \<feature>" status message confusingly.
#[macro_export]
macro_rules! language_server_with_feature {
($editor:expr, $doc:expr, $feature:expr) => {{