Automatic indenting gets in the way when deleting
I was going to report that single line If statements still indent when it's not needed, but that caused me to notice this more bothering glitch.
Paste this into a new VB Statements query:
Now select from the end of the indented End If to the If of the next line.
Press enter.
If this is repeatable as it has been for me, you'll have:
That the first Ctrl+Z shows some automatic indentation gave me the title of this thread.
A somewhat similar undoable glitch that I can't exactly repro is sometimes Ctrl+Space clears to the end of the expression or line when it places the selected text. I think I've had it occur both when using the keyboard only (with my mouse out of the way) and when double clicking on a menu selection.
Paste this into a new VB Statements query:
If True Then Beep End If If False Then Beep End IfYou ought to need to then type Ctrl+Z to undo the automatic correction to the indentation.
Now select from the end of the indented End If to the If of the next line.
Press enter.
If this is repeatable as it has been for me, you'll have:
If True Then If False Then Beep End IfLuckily Ctrl+Z (twice) undoes this correctly.
That the first Ctrl+Z shows some automatic indentation gave me the title of this thread.
A somewhat similar undoable glitch that I can't exactly repro is sometimes Ctrl+Space clears to the end of the expression or line when it places the selected text. I think I've had it occur both when using the keyboard only (with my mouse out of the way) and when double clicking on a menu selection.
Comments
Press enter.
Again you end up with: And again it is undoable, with three Ctrl+Zs this time!
Paste this in a new VB Statement(s) query: Put the cursor at the end of
An
and type Ctrl+Space.Choose "And" (with an up or down arrow, or with the mouse) and select it (with space, return* or double-clicking the mouse).
You're left with: Undoing works.
(*)Return does insert a new line after the
And
.How far it extends the selection forward before replacing it with the chosen selection is not exactly clear, but it seems to correspond to something like the next expression, excluding the final delimiter. E.g. This: Becomes this: with the same steps (with the proviso return does insert a new line).
Note you can type the "d" while the menu is open and then space (or the other ways of selecting the current menu item) and the problem does still occur, but if you type the "d", then Ctrl+Space and choose "AndAlso" things work correctly! (Choosing "AndAlso" or anything else above causes the problem, not just "And".)
I think you can replace
An
with any non-blue keyword and have the problem. From what I've tried a blue keyword can be replaced by any other selection and not have the problem.Now to the "interesting quirk": Put a
(
at the start of the query, and try to follow the steps again.You'll now see the Ctrl+Space displays a menu as if you had the cursor at
Simple
and I've just reported a bug when you replace "Simple" by a space before typing Ctrl+Space further along the text.http://www.linqpad.net/download.aspx#beta5