Allow indenting blocks (multiple lines) with on push of tab


#1

Currently I need to tab every line individually, this makes it hard to reorganize you identation, when you want to surround some states by a parent state.

So it would be nice to be able to select text, push tab, and all text would be intented, see https://screencast.com/t/kH0Jjp3rAv3


#2

Sorry for the delayed response @RolandStuder; I don’t have Flash on my machine so I haven’t been able to watch that video.

The editor in Sketch.systems supports multi-line indent via keyboard shortcut. You need to have multiple lines in the selection. Here’s what it looks like:

On MacOS, the shortcuts are ⌘] for indent and ⌘[ for dedent. I haven’t confirmed on Windows, but CTRL+[ and CTRL+[ should probably work.

Does that match the behavior you’re looking for?


#3

Too bad, those do not seem to work for me using a German keyboard layout on a Mac. [ and ] are placed at Opt+5 and Opt+6 respectively. Cmd+Opt+5/6 seems to trigger some browser history action (in Chrome at least) while Cmd+5/6 switches tabs. Might be missing something, though :man_shrugging:

Great tool, btw., speaking as a designer.


#4

Sorry for that, Richy. The editor in Sketch.systems is CodeMirror, so it might be worth bringing up this issue to the maintainers on their forum or Github. As we found out when working on Subform, internationalizing keyboard shortcuts can be really difficult.

And thanks for the kind words. :slight_smile:


#5

Hi Ryan,
I’ve looked a little bit into it and found that selecting multiple characters here: http://codemirror.net/ and pressing tab does indent the line(s) in the code editor. (Which is probably what most people with German and similar keyboard layouts usually do, because in VSCode for example you need all your fingers and your nose tip to trigger the default ‘indent line’ shortcut.) It doesn’t work the same way in Sketch.systems though, thus I wonder whether this is a configuration issue?
Here’s a demonstration: https://imgur.com/a/OnhIAS0


#6

I pushed up a config fix that should make tab and shift-tab work for multiselect indents/dedents. Give it a shot and let me know if it’s working for you.


#7

Works perfectly, thanks a lot!


#8

Awesome. Thanks for looking into it!


#9

Follow up on this @richy:

Unfortunately, the config change caused some parsing errors due to the introduction of mixed tabs and spaces. I’ve reversed the commit for the time being while I track down the issues and formulate a better solution.

I’ll let you know if/when we’re able to get this working again for you.