Skip to content

Commit 902a038

Browse files
authored
feat: add functionality to shift+tab on (#150)
a single line to remove starting tab
1 parent aa3a07a commit 902a038

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/shortcuts.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export default function shortcuts(e: React.KeyboardEvent<HTMLTextAreaElement>) {
1313
if (code === 'tab') {
1414
stopPropagation(e);
1515
if (api.start === api.end) {
16-
api.insertText(' ').position(api.start + 2, api.end + 2);
16+
if (e.shiftKey) {
17+
api.lineStarRemove(' ');
18+
} else {
19+
api.insertText(' ').position(api.start + 2, api.end + 2);
20+
}
1721
} else if (api.getSelectedValue().indexOf('\n') > -1 && e.shiftKey) {
1822
api.lineStarRemove(' ');
1923
} else if (api.getSelectedValue().indexOf('\n') > -1) {

0 commit comments

Comments
 (0)