From 50d1b8aae8b84eafdbfadf57548d072403b7116c Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Sat, 21 Oct 2017 14:12:33 +0200 Subject: [PATCH] fix(editor): Unindent line when nothing is selected Pressing SHIFT + TAB while no text is selected would indent the text which is uncommon behavior. This change will always unindent the code regardless of whether text is selected or not. --- common/app/routes/challenges/views/classic/Editor.jsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/app/routes/challenges/views/classic/Editor.jsx b/common/app/routes/challenges/views/classic/Editor.jsx index 3240805455..5d33a8c5d6 100644 --- a/common/app/routes/challenges/views/classic/Editor.jsx +++ b/common/app/routes/challenges/views/classic/Editor.jsx @@ -78,11 +78,7 @@ export class Editor extends PureComponent { return cm.replaceSelection(spaces); }, 'Shift-Tab': function(cm) { - if (cm.somethingSelected()) { - return cm.indentSelection('subtract'); - } - const spaces = Array(cm.getOption('indentUnit') + 1).join(' '); - return cm.replaceSelection(spaces); + return cm.indentSelection('subtract'); }, 'Ctrl-Enter': function() { executeChallenge();