Skip to content

Commit d9713fe

Browse files
authored
Merge pull request #656 from asolove/cm-tabs
When user types tab, translate it into spaces for consistency
2 parents 8c90cb5 + 516e532 commit d9713fe

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ide.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,15 @@ export class Editor {
657657
"Cmd-1": () => this.format({type: "heading", level: 1}),
658658
"Cmd-2": () => this.format({type: "heading", level: 2}),
659659
"Cmd-3": () => this.format({type: "heading", level: 3}),
660-
"Cmd-L": () => this.format({type: "item"})
660+
"Cmd-L": () => this.format({type: "item"}),
661+
"Tab": (cm) => {
662+
if (cm.somethingSelected()) {
663+
cm.indentSelection("add");
664+
} else {
665+
cm.replaceSelection(cm.getOption("indentWithTabs")? "\t":
666+
Array(cm.getOption("indentUnit") + 1).join(" "), "end", "+input");
667+
}
668+
}
661669
})
662670
};
663671

0 commit comments

Comments
 (0)