Updated to use grapheme helpers

pull/9483/head
Steven 10 months ago
parent 0311256d34
commit 091ec45740

@ -109,10 +109,11 @@ Normal mode is the default mode when you launch helix. You can return to it from
### Selection manipulation
| Key | Description | Command |
| ----- | ----------- | ------- |
|----------------------| ----------- | ------- |
| `s` | Select all regex matches inside selections | `select_regex` |
| `S` | Split selection into sub selections on regex matches | `split_selection` |
| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
| `Alt-S` | Select first and last characters of each selection | `select_first_and_last_chars` |
| `Alt-minus` | Merge selections | `merge_selections` |
| `Alt-_` | Merge consecutive selections | `merge_consecutive_selections` |
| `&` | Align selection in columns | `align_selections` |

@ -1814,11 +1814,12 @@ fn select_all(cx: &mut Context) {
fn select_first_and_last_chars(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform_iter(|range| {
vec![
Range::new(range.anchor, range.anchor + 1),
Range::new(range.head - 1, range.head),
[
Range::new(range.from(), graphemes::next_grapheme_boundary(text, range.from())),
Range::new(graphemes::prev_grapheme_boundary(text, range.to()), range.to())
]
.into_iter()
});

Loading…
Cancel
Save