Ignore cursor jumping shortcuts with shift

This tweaks the new cursor jumping shortcuts in the composer so that they only
activate without shift. When shift _is_ pressed, you want to extend the
selection instead of just moving.

Fixes https://github.com/vector-im/riot-web/issues/12549
This commit is contained in:
J. Ryan Stinnett 2020-02-27 11:38:31 +00:00
parent c7246f8eab
commit b6a21509d5

View file

@ -393,14 +393,14 @@ export default class BasicMessageEditor extends React.Component {
this._insertText("\n"); this._insertText("\n");
handled = true; handled = true;
// move selection to start of composer // move selection to start of composer
} else if (modKey && event.key === Key.HOME) { } else if (modKey && event.key === Key.HOME && !event.shiftKey) {
setSelection(this._editorRef, model, { setSelection(this._editorRef, model, {
index: 0, index: 0,
offset: 0, offset: 0,
}); });
handled = true; handled = true;
// move selection to end of composer // move selection to end of composer
} else if (modKey && event.key === Key.END) { } else if (modKey && event.key === Key.END && !event.shiftKey) {
setSelection(this._editorRef, model, { setSelection(this._editorRef, model, {
index: model.parts.length - 1, index: model.parts.length - 1,
offset: model.parts[model.parts.length - 1].text.length, offset: model.parts[model.parts.length - 1].text.length,