SIGN IN SIGN UP

New key bindings for shift-based text selection in Emacs mode

This refers to issue #979.

Text can be selected and the selection extended with
shift + cursor movement (`left`, `right`, `up`, `down`, `home`, `end`,
`ctrl-left`, `ctrl-right`, `ctrl-home`, `ctrl-end`).

For completeness, `ctrl-home` and `ctrl-end` bindings (beginning and
end of buffer) are also added, through new readline style commands
(`'beginning-of-buffer'` and `'end-of-buffer'`).

The selection is replaced by any text that is typed (including
pasting/yanking, and enter, if multi-line).

A cursor movement without shift while in selection mode cancels
the selection.

This works alongside the standard Emacs marking mode (started with
`Ctrl-space`). The difference is handled by adding a `shift_mode`
boolean in the `SelectionState` (set by the `enter_shift_mode()`
method) and a corresponding `shift_selection_mode filter`.

All the related bindings are defined in a new
`load_emacs_shift_selection_bindings()` function, now called
in `key_binding.defaults.load_key_bindings`.

Other changes include
* adding the required keys in `keys.py`
* processing them properly
  in `input.win32.ConsoleInputReader._event_to_key_presses`
* defining default empty handlers in `key_binding.bindings.basic.py`
S
scoennz committed
9d7e5c8dae4dc3ca200f7ea710ebb0ecf092bef9
Parent: ebe2da0
Committed by Jonathan Slenders <jonathan@slenders.be> on 11/8/2019, 11:51:40 AM