Home
Options

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:
If True Then
	Beep
	End If
	If False Then
	Beep
End If
You 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 If
Luckily 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

  • Options
    Actually it's simpler: paste this:
    If True Then
    	Beep
    	End IfIf False Then
    	Beep
    End If
    
    Place the cursor between the two connected "If"s.

    Press enter.

    Again you end up with:
    If True Then
    If False Then
    	Beep
    End If
    
    And again it is undoable, with three Ctrl+Zs this time!
  • Options
    Thanks for the repro - this should be fixed now in 5.0.9
  • Options
    Seems to be. "Single line If statements still indent when it's not needed" though :smile:
  • Options
    I now have repros for the "similar undoable glitch" re Ctrl+Space, and a related "interesting quirk":

    Paste this in a new VB Statement(s) query:
    Simple Is Nothing An Example
    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:
    Simple Is Nothing And
    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:
    Simple Is Nothing An _
    (Example And More), More
    
    Becomes this:
    Simple Is Nothing And), More
    
    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.
  • Options
    These issues should all now be fixed with 5.0.10:

    http://www.linqpad.net/download.aspx#beta5
Sign In or Register to comment.