1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
use crate::selection::Selection;
use crate::selection_function;
use crate::selection_functions::types::{get_buffer, SFArguments, SFError, SFResult};
use crate::state::EditorState;
selection_function! {
name: end_sequential,
niladic: |es: &EditorState| {
let buf = get_buffer(es, es.current_buffer_id)?;
Ok(Selection::Position {
buffer_id: es.current_buffer_id,
pos: buf.max_pos()
})
},
monadic_rank0: |_, buffer_id, pos| {
Ok(Selection::Position { buffer_id, pos })
},
monadic_rank1: |_, buffer_id, interval| {
Ok(Selection::Position {
buffer_id,
pos: interval.end,
})
}
}
selection_function! {
name: end_structural,
niladic: |es: &EditorState| {
let buf = get_buffer(es, es.current_buffer_id)?;
Ok(Selection::Position {
buffer_id: es.current_buffer_id,
pos: buf.max_pos(),
})
},
monadic_rank0: |_, buffer_id, pos | Ok(Selection::Position { buffer_id, pos }),
monadic_rank1: |_, buffer_id, int | Ok(Selection::Position { buffer_id, pos: int.end })
}
|