While I wait for the Standardised formatting to appear on Down/Up arrows, I have been pressing Shift-Return to format my current line.
While this works most of the time, if I press Shift-Return within an If(True, “”, “”) statement on a line, it breaks my line into a full If…Then…Else statement with my line changed and duplicated, and Undo doesn’t undo the damage!
Is this only me? Shall I add a Feedback report for something so trivial?
I complained about this myself in Feedback. They said it was “expected” behavior so they would not accept it as a bug.
In any case, it is clearly undesirable for people such as myself who often use one line If/Then statement and expect it to stay as one line. I find that it makes my code clearer and easier to read.
I thought that their response to me was bizarre. But there is a sliver of hope IMO. I think that the whole Standardised Formatting functionality is in flux with the engineers at Xojo. I think/hope they are trying to design a system that allows a user to select as a preference to have, or have not, automatic application of Standardized Formatting.
I am guessing that they did not want to deal with this “little thing” while the whole system is in flux.
So it seems Shift-Return performs two functions which sometimes clash when ambiguous. Not helpful.
I don’t want to have to remember to ensure nothing is selected, move my mouse away to the top of the screen and click the Standardise button every time I want Standard format.
The fact that the undo command doesn’t undo the conversion (as David mentions) is still a bug.
Out of curiosity, would you expect something else to happen, or just nothing? If the latter, then it’s better to have a thing happening than nothing at all, even if it’s not your intention (just don’t press shift-return).
For example, if I have entered the following code and want to standardise the formatting:
var myString As String="Test"
myString = if(myString="Test","New Value",myString)
If I place my cursor anywhere on the first line and press Shift-Return I get this (fixes case and pads spaces): Var myString As String = "Test"
Whereas if I place my cursor anywhere on the second line and press Shift-Return I get this (assumes I want a multi-line if-then-else, rather than just fixing case and padding spaces):
If myString = "Test" Then
myString = "New Value"
Else
myString = myString
End If
when I really wanted (achieved by copy and pasting the second line): myString = If(myString = "Test", "New Value", myString)
Oh, I see now. It’s true I never use code standardisation.
What I’m seeing as a problem is that shift+return does two distinct things (code standardisation and expansion). Logically, they should be two different shortcuts.