Merge pull request #1174 from processing/indenting-updates

re #1067, when a line or lines are highlighted, tab will indent them
This commit is contained in:
Cassie Tarakajian 2019-10-03 14:51:06 -04:00 committed by GitHub
commit b251b12493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,7 +108,15 @@ class Editor extends React.Component {
delete this._cm.options.lint.options.errors; delete this._cm.options.lint.options.errors;
this._cm.setOption('extraKeys', { this._cm.setOption('extraKeys', {
Tab: cm => cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT)), Tab: (cm) => {
// might need to specify and indent more?
const selection = cm.doc.getSelection();
if (selection.length > 0) {
cm.execCommand('indentMore');
} else {
cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT));
}
},
[`${metaKey}-Enter`]: () => null, [`${metaKey}-Enter`]: () => null,
[`Shift-${metaKey}-Enter`]: () => null, [`Shift-${metaKey}-Enter`]: () => null,
[`${metaKey}-F`]: 'findPersistent', [`${metaKey}-F`]: 'findPersistent',