Skip to content

Commit c133fcc

Browse files
author
Ives van Hoorne
committed
Better tab indenting
1 parent 041d30e commit c133fcc

File tree

1 file changed

+9
-0
lines changed
  • src/app/components/sandbox/CodeEditor

1 file changed

+9
-0
lines changed

src/app/components/sandbox/CodeEditor/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ export default class CodeEditor extends React.PureComponent {
237237
'Ctrl-.': cm => {
238238
if (this.server) this.server.selectName(cm);
239239
},
240+
Tab: cm => {
241+
// Indent, or place 2 spaces
242+
if (cm.somethingSelected()) {
243+
cm.indentSelection('add');
244+
} else {
245+
const spaces = Array(cm.getOption('indentUnit') + 1).join(' ');
246+
cm.replaceSelection(spaces, 'end', '+input');
247+
}
248+
},
240249
...defaultKeys,
241250
});
242251
} else {

0 commit comments

Comments
 (0)