aboutsummaryrefslogtreecommitdiff
path: root/rprt-engine/src/selection_functions/function_end.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rprt-engine/src/selection_functions/function_end.rs')
-rw-r--r--rprt-engine/src/selection_functions/function_end.rs32
1 files changed, 25 insertions, 7 deletions
diff --git a/rprt-engine/src/selection_functions/function_end.rs b/rprt-engine/src/selection_functions/function_end.rs
index 3f18fd3..cec7c90 100644
--- a/rprt-engine/src/selection_functions/function_end.rs
+++ b/rprt-engine/src/selection_functions/function_end.rs
@@ -1,11 +1,15 @@
-use crate::selection::Selection;
-use crate::selection_function;
-use crate::selection_functions::types::{get_buffer, SFArguments, SFError, SFResult};
-use crate::state::EditorState;
+use crate::{
+ dispatch_selection_function,
+ selection::Selection,
+ selection_function,
+ selection_functions::types::{get_buffer, SFArguments, SFError, SFResult},
+ state::EditorState,
+};
selection_function! {
name: end,
- niladic: |es: &EditorState| {
+ param_type: (),
+ niladic: |(_, es): ((), &EditorState)| {
let buf = get_buffer(es, es.current_buffer_id)?;
Ok(Selection::Position {
buffer_id: es.current_buffer_id,
@@ -18,7 +22,8 @@ selection_function! {
selection_function! {
name: reverse_end,
- niladic: |es: &EditorState| {
+ param_type: (),
+ niladic: |(_, es): ((), &EditorState)| {
Ok(Selection::Position {
buffer_id: es.current_buffer_id,
pos: 0,
@@ -30,9 +35,10 @@ selection_function! {
selection_function! {
name: sequential_end,
+ param_type: (),
niladic: |_| Err(SFError::NoNiladicForm(";$").into()),
monadic_rank0: |_, buffer_id, pos| Ok(Selection::Position { buffer_id, pos }),
- monadic_rank1: |es, buffer_id, _| {
+ monadic_rank1: |(_, es), buffer_id, _| {
let buf = get_buffer(es, buffer_id)?;
Ok(Selection::Position { buffer_id, pos: buf.max_pos() })
}
@@ -40,6 +46,7 @@ selection_function! {
selection_function! {
name: sequential_reverse_end,
+ param_type: (),
niladic: |_| Err(SFError::NoNiladicForm(";'$").into()),
monadic_rank0: |_, buffer_id, pos| {
Ok(Selection::Position { buffer_id, pos })
@@ -54,6 +61,7 @@ selection_function! {
selection_function! {
name: reverse_sequential_end,
+ param_type: (),
niladic: |_| Err(SFError::NoNiladicForm("';$").into()),
monadic_rank0: |_, buffer_id, pos| {
Ok(Selection::Position { buffer_id, pos })
@@ -65,3 +73,13 @@ selection_function! {
})
}
}
+
+dispatch_selection_function!(
+ name: selection_function_end,
+ param_type: (),
+ base: end,
+ sequential: sequential_end,
+ reverse: reverse_end,
+ sequential_reverse: sequential_reverse_end,
+ reverse_sequential: reverse_sequential_end,
+);