Feedback 44939 - Pasting code into the code editor suddenly trims leading whitespace

You might not have been BUT suppose you do

  1. you have “abc defghi” on a line
  2. select [space]def
  3. paste to a new line
  4. observe that the space is there at the beginning of the line
  5. save as text format
  6. close project & reopen it
  7. observe space is gone
    I’m sure you’d report a bug here

So one problem naturally leads in to needing to solve the other - they’re not 100% independent of each other

I don’t get the connection. Every other IDE gets it right. Even RB and Xojo got it right till 2016.

This is meant sarcastically of course: don’t you have more important stuff to do than to introduce something like this. And for what reason was that introduced? And why does every other IDE get it right (Xcode, Netbeans, Aptana, VS, Fire (RemObjects), which I all have used lately)?

It started to do this in 2015R4.
<https://xojo.com/issue/42517>
Super annoying.

As for Norman’s example, the beginning of a line is handled by Xojo. As far as I know, leading spaces on a line were always stripped. And if not, I’m fine with that. Xojo does the indentation for me.

However, this is a situation that happens a lot:
1.you have “abc defghi” on a line
2.select [space]def
3.paste to the end of the line
4.observe the space is gone. It now says “abc defghidef” instead of “abc defghi def”

And I see it’s fixed. Thanks Norman, this has been driving me mad too.

Nice! Thank you Norman

[quote=282888:@Eli Ott]I don’t get the connection. Every other IDE gets it right. Even RB and Xojo got it right till 2016.
[/quote]
It mostly got it right - up to 2015r4
Until you save as text & reopen and IF you happened to have spaces at the beginning of the line they’re now gone

[quote=282888:@Eli Ott]This is meant sarcastically of course: don’t you have more important stuff to do than to introduce something like this.
[/quote]
Since the IDE IS my main responsibility - umm … no ???

[quote=282888:@Eli Ott]And for what reason was that introduced?
[/quote]
There were 2 other bugs that we made chnages to fix - apparently one of those fixes introduced this behaviour

IMO, since the IDE handles indentation for you, it shouldn’t be possible to have spaces at the beginning of a line in the code editor.

Realistically there’s no reason why not
Some folks seem to want that to align their comments in specific ways

like

 if a then         // comment comment comment
                   // comment continuation

The problem is that loading from TEXT format will strip them
And it only has to do this because it uses tabs + spaces to indent the code IN the text formatted file
And if it didn’t strip them then every subsequent time it wrote your code out it would add more & more spaces

You can see where that leads :stuck_out_tongue:

Binary & XML dont have this problem as they use tags to delimit the start & end of line so they know where the line starts & ends :slight_smile: