helix-mirror/helix-term/src
Michael Davis e0b5cdfb47
prevent selection collapse when inserting a newline (#2414)
Inserting a newline currently collapses any connected selections when inserting
or appending. It's happening because we're reducing the selections down to
their cursors (`let selection = ..` line) and then computing the new selection
based on the cursor. We're discarding the original head and anchor information
which are necessary to emulate Kakoune's behavior.

In Kakoune, inserting a newline retains the existing selection and _slides_
it (moves head and anchor by the same amount) forward by the newline and
indentation amount. Appending a newline extends the selection to include the
newline and any new indentation.

With the implementation of insert_newline here, we slide by adding the global
and local offsets to both head and anchor. We extend by adding the global
offset to both head and anchor but the local offset only to the head.
2022-05-11 09:53:43 +09:00
..
commands Making the 'set-option' command help more descriptive. (#2365) 2022-05-04 11:17:08 +09:00
keymap Add undo checkpoint command (#2115) 2022-05-02 23:45:20 +09:00
ui Auto-complete directory members (#1801) (#1907) 2022-05-02 23:18:41 +09:00
application.rs allow whitespace to be rendered 2022-04-20 11:37:23 +09:00
args.rs Add refresh-config and open-config command (#1803) 2022-03-25 18:05:20 +09:00
commands.rs prevent selection collapse when inserting a newline (#2414) 2022-05-11 09:53:43 +09:00
compositor.rs Make regex_prompt directly call cx.push_layer 2022-03-28 11:02:13 +09:00
config.rs Move top level lsp config to editor.lsp (#1868) 2022-03-28 10:11:52 +09:00
health.rs Add true or false checkbox in health output table (#1947) 2022-04-12 17:21:16 +09:00
job.rs Don't use block_on in jobs.finish(), we can .await 2022-02-05 15:05:19 +09:00
keymap.rs Add refresh-config and open-config command (#1803) 2022-03-25 18:05:20 +09:00
lib.rs Add refresh-config and open-config command (#1803) 2022-03-25 18:05:20 +09:00
main.rs Add support for local language configuration (#1249) 2022-04-18 12:10:51 +09:00