Indenting

Sometimes when you hit backspace in the editor, it deletes some of the text before that space too. Not a big deal but would be nice to fix. I think it’s because it thinks i’m removing a level of indenting. To reproduce type "a " with three spaces, and then backspace and it will the delete the a

While i’m at it, the keyboard button to add indenting to a selected Block is super useful. Could we add a button for removing a level of indenting to a block? Maybe if i keep the add indenting button pressed for a sec then it pops up an option…

the end unindent would be dandy. I habitually backspace now before end.

How about automatic indentation? I find editing the text very awkward on the iPad, even with the helpful extra keys in Codea. Remember VB6? (Be thankful if you don’t) The IDE automatically formatted your code as you typed. Maybe Codea could do the same for Lua code.

@ruilov thanks for finding that backspace bug, I’ll fix it so that it doesn’t erase text in that case. Could you put it on the issue tracker?

Doing a block level un-indent is possible. Where to put the button is the main thing. Your touch-and-hold on tab seems best so far.

@Nat what sort of rules would you like to see for Lua automatic indentation?

At the moment, the editor inserts a tab after a line that begins a control structure (e.g., new function, if/for statement). I have been thinking about doing an automatic un-indent on a line if you type “end” and the line above is indented to the same level.

+1 for automatic unindenting.
+1 for block un/indent.

I request for an option to choose indent depth: 4 spaces or 2 spaces. :slight_smile:

Three spaces is the One True Spacing.

2, 3, or 4 as long a columns 1-6 are ignored, anything in column 72 or after is ignored, and an * in column 7 comments the line

Ha ha you’re old.

Wait a minute. I recognized that. I’ve programmed that.

Now I’m old.

Make block in-indent the shift alternative to block indent.

Nice idea @Mark. A brief look into the SDK tells me this might not be possible on iOS (to detect whether the shift key is pressed on the standard keyboard). But I’ll keep looking.