aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/exceptions/command_syntax_exception.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-17 14:02:13 -0500
committermat <github@matdoes.dev>2022-04-17 14:02:13 -0500
commita72a47ced76065caf739898954cd18edbc39174b (patch)
tree5526c7663f253bbd7c8318b9d98413f1f2074852 /azalea-brigadier/src/exceptions/command_syntax_exception.rs
parent4ff67d4917ce333232189e86aee09f2d82451fc6 (diff)
downloadazalea-drasl-a72a47ced76065caf739898954cd18edbc39174b.tar.xz
Rewrite brigadier
Diffstat (limited to 'azalea-brigadier/src/exceptions/command_syntax_exception.rs')
-rw-r--r--azalea-brigadier/src/exceptions/command_syntax_exception.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/azalea-brigadier/src/exceptions/command_syntax_exception.rs b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
index 38aa1c3a..6cd4e53d 100644
--- a/azalea-brigadier/src/exceptions/command_syntax_exception.rs
+++ b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
@@ -3,6 +3,7 @@ use std::{cmp, fmt, rc::Rc};
use super::builtin_exceptions::BuiltInExceptions;
use crate::message::Message;
+#[derive(Clone)]
pub struct CommandSyntaxException {
type_: BuiltInExceptions,
message: Message,
@@ -59,7 +60,10 @@ impl CommandSyntaxException {
builder.push_str("...");
}
- builder.push_str(&input[cmp::max(0, cursor - CONTEXT_AMOUNT)..cursor]);
+ builder.push_str(
+ &input
+ [(cmp::max(0, cursor as isize - CONTEXT_AMOUNT as isize) as usize)..cursor],
+ );
builder.push_str("<--[HERE]");
return Some(builder);