insert spaces on <Tab> when editor.indentWithTabs is false
This commit is contained in:
parent
923f55d532
commit
05dbcff7c3
|
@ -19,6 +19,9 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
nextEditor, prevEditor,
|
nextEditor, prevEditor,
|
||||||
commentSelection,
|
commentSelection,
|
||||||
};
|
};
|
||||||
|
const ORIGINAL_COMMANDS = {
|
||||||
|
insertTab: CodeMirror.commands.insertTab,
|
||||||
|
};
|
||||||
// reroute handling to nearest editor when keypress resolves to one of these commands
|
// reroute handling to nearest editor when keypress resolves to one of these commands
|
||||||
const REROUTED = new Set([
|
const REROUTED = new Set([
|
||||||
'save',
|
'save',
|
||||||
|
@ -244,6 +247,12 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
CodeMirror.setOption('indentUnit', value);
|
CodeMirror.setOption('indentUnit', value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'indentWithTabs':
|
||||||
|
CodeMirror.commands.insertTab = value ?
|
||||||
|
ORIGINAL_COMMANDS.insertTab :
|
||||||
|
CodeMirror.commands.insertSoftTab;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'theme': {
|
case 'theme': {
|
||||||
const themeLink = $('#cm-theme');
|
const themeLink = $('#cm-theme');
|
||||||
// use non-localized 'default' internally
|
// use non-localized 'default' internally
|
||||||
|
|
Loading…
Reference in New Issue
Block a user