diff options
author | Michael Davis | 2022-05-11 00:53:43 +0000 |
---|---|---|
committer | GitHub | 2022-05-11 00:53:43 +0000 |
commit | e0b5cdfb477108a5cbd40afd9384a96b50d46fbb (patch) | |
tree | c2419316e6bac727dca975ab9bb82719e728e475 /book/theme | |
parent | 40647f03ed561532727d5939ccccf485045c4b5e (diff) |
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.
Diffstat (limited to 'book/theme')
0 files changed, 0 insertions, 0 deletions