on master help sign in
Merge `x` and `X`
f41688dBlaž Hrastnik
book/src/keymap.md+2−3
@@ -69,9 +69,8 @@
69| `;` | Collapse selection onto a single cursor |
69| `;` | Collapse selection onto a single cursor |
70| `Alt-;` | Flip selection cursor and anchor |
70| `Alt-;` | Flip selection cursor and anchor |
71| `%` | Select entire file |
71| `%` | Select entire file |
72−| `x` | Select current line |
72+| `x` | Select current line, if already selected, extend to next line |
73−| `X` | Extend to next line |
74−| `[` | Expand selection to parent syntax node TODO: pick a key |
73+| `` | Expand selection to parent syntax node TODO: pick a key |
75| `J` | join lines inside selection |
74| `J` | join lines inside selection |
76| `K` | keep selections matching the regex TODO: overlapped by hover help |
75| `K` | keep selections matching the regex TODO: overlapped by hover help |
77| `Space` | keep only the primary selection TODO: overlapped by space mode |
76| `Space` | keep only the primary selection TODO: overlapped by space mode |
helix-term/src/commands.rs−15
@@ -888,21 +888,6 @@ fn search_selection(cx: &mut Context) {
888
888
889//
889//
890
890
891−fn select_line(cx: &mut Context) {
892− let count = cx.count();
893− let (view, doc) = current!(cx.editor);
894−
895− let pos = doc.selection(view.id).primary();
896− let text = doc.text();
897−
898− let line = text.char_to_line(pos.head);
899− let start = text.line_to_char(line);
900− let end = text
901− .line_to_char(std::cmp::min(doc.text().len_lines(), line + count))
902− .saturating_sub(1);
903−
904− doc.set_selection(view.id, Selection::single(start, end));
905−}
906fn extend_line(cx: &mut Context) {
891fn extend_line(cx: &mut Context) {
907 let count = cx.count();
892 let count = cx.count();
908 let (view, doc) = current!(cx.editor);
893 let (view, doc) = current!(cx.editor);
helix-term/src/keymap.rs+1−3
@@ -196,9 +196,7 @@ impl Default for Keymaps {
196 key!(';') => Command::collapse_selection,
196 key!(';') => Command::collapse_selection,
197 alt!(';') => Command::flip_selections,
197 alt!(';') => Command::flip_selections,
198 key!('%') => Command::select_all,
198 key!('%') => Command::select_all,
199− key!('x') => Command::select_line,
199+ key!('x') => Command::extend_line,
200− key!('X') => Command::extend_line,
201− // or select mode X?
202 // extend_to_whole_line, crop_to_whole_line
200 // extend_to_whole_line, crop_to_whole_line
203
201
204
202