Comment / Uncomment works erratic in Playground

I noticed a weird behavior of Editor in a Playground.


This is an OSX playground.

XCode 10.1ß3

OSX 10.13.6


The playground is about 400 lines


When I type cmd-/ to comment or uncomment a line, everything works OK til a certain line in code

After this line, cmd- does not work, but instead copies the line above and comment it, replacing the original line.


After some test, I found that this exact line is causing the problem


aTri[i][k] = x // Use scaled a’s for transformation.


And in fact the last char: the dot and ansome invisible char after:


So, I copied the end of line ; as it inserted a return line in my string, I used multiline

var pbstr : String = """

.

"""


reading the unicode

for v in (pbstr.unicodeScalars) {
    print(v.value)
}


yields

46

32

10


I thus copied and paste these 3 char a few lines above and the problem started to appear just there as well.


So, it appears that the LF char at the end is confusing the Editor. In fact, there should never be a LF there (it came from some text I copied and paste here)


Did anyone notice ? Have an explanation ?

Accepted Reply

Comment / Uncomment is sensitive to some specific chars in text.


For instance, a line of code with /* … */ inside, like


    let alert = UIAlertController(title: "" /*"***** texte"*/, message: "Love\nWe'll recommend more for you" /* Entrez des chiffres"*/, preferredStyle: .alert) 

Causes comment command not to work beyond the line.


I filed a bug report on this : #49907361, which is DUPLICATE OF 44319433

Replies

Comment / Uncomment is sensitive to some specific chars in text.


For instance, a line of code with /* … */ inside, like


    let alert = UIAlertController(title: "" /*"***** texte"*/, message: "Love\nWe'll recommend more for you" /* Entrez des chiffres"*/, preferredStyle: .alert) 

Causes comment command not to work beyond the line.


I filed a bug report on this : #49907361, which is DUPLICATE OF 44319433