diff options
author | Blaž Hrastnik | 2021-08-22 06:00:07 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-08-22 06:00:07 +0000 |
commit | 607b92b2e374f7b19e167da6d417dc6ae25bafe8 (patch) | |
tree | c7a60da44efcd7f8b94c5ece9da10d0064d4f2f0 /helix-term | |
parent | 59e0ceef8c764950199a7e6874e15150ba329af3 (diff) |
fix: Place the cursor on the start of the selected symbol
Fixes #626
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/commands.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index d7d50109..a78f137a 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2330,7 +2330,9 @@ fn symbol_picker(cx: &mut Context) { if let Some(range) = lsp_range_to_range(doc.text(), symbol.location.range, offset_encoding) { - doc.set_selection(view.id, Selection::single(range.anchor, range.head)); + // we flip the range so that the cursor sits on the start of the symbol + // (for example start of the function). + doc.set_selection(view.id, Selection::single(range.head, range.anchor)); align_view(doc, view, Align::Center); } }, |