doc: Explain why a modifies the selection and i doesn't

This commit is contained in:
Frank LENORMAND 2017-06-22 12:44:47 +03:00
parent 9e53e00552
commit f57a4e589e

View File

@ -191,3 +191,16 @@ In order to open buffers in the same window simultaneously using `tmux`
(or one of the supported multiplexers), run Kakoune in a `tmux` session, (or one of the supported multiplexers), run Kakoune in a `tmux` session,
and simply use the `:new` command to spawn new clients as you would and simply use the `:new` command to spawn new clients as you would
have otherwise in an X11 environment. have otherwise in an X11 environment.
Why does `a` extend the current selection, but `i` leaves it untouched ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Selections are ranges of characters whose delimiters are an "anchor" and
a "cursor", and inserting characters is always done before the cursor in
insert mode.
Consequently, using the append primitive (`a`) nudges the cursor forward to
make room for characters, effectively extending the current selection since
the anchor remains immobile, even when the anchor and the cursor are at the
same location. By opposition, using the insert primitive (`i`) merely adds
characters before the cursor, which never modifies the current selection.