Skip to content

Commit

Permalink
feat: add functionality to shift+tab on (#150)
Browse files Browse the repository at this point in the history
a single line to remove starting tab
  • Loading branch information
bombillazo authored Jun 9, 2023
1 parent aa3a07a commit 902a038
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export default function shortcuts(e: React.KeyboardEvent<HTMLTextAreaElement>) {
if (code === 'tab') {
stopPropagation(e);
if (api.start === api.end) {
api.insertText(' ').position(api.start + 2, api.end + 2);
if (e.shiftKey) {
api.lineStarRemove(' ');
} else {
api.insertText(' ').position(api.start + 2, api.end + 2);
}
} else if (api.getSelectedValue().indexOf('\n') > -1 && e.shiftKey) {
api.lineStarRemove(' ');
} else if (api.getSelectedValue().indexOf('\n') > -1) {
Expand Down

0 comments on commit 902a038

Please sign in to comment.