From 902a038ab3506f70506821df209d3b50fa8378e3 Mon Sep 17 00:00:00 2001 From: Hector Ayala Date: Thu, 8 Jun 2023 23:07:31 -0400 Subject: [PATCH] feat: add functionality to shift+tab on (#150) a single line to remove starting tab --- src/shortcuts.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shortcuts.ts b/src/shortcuts.ts index 8e0a2c89..5a918518 100644 --- a/src/shortcuts.ts +++ b/src/shortcuts.ts @@ -13,7 +13,11 @@ export default function shortcuts(e: React.KeyboardEvent) { 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) {