Skip to content

Multiline uncommenting acts weird, causes errors #31

@dragoncoder047

Description

@dragoncoder047

Go to the Prism Live web site, scroll down to the JS, and select something more than one line. For example, select setCaret() here

setCaret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}

moveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

(Not that this is where the problem may be; it's just what I happened to be staring at when I noticed this bug.)

Press Ctrl+/, and it comments out like it should:

/*setCaret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}*/

moveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

Notice the selection includes the /* */ markers. With those still selected press Ctrl+/ again and it just adds more comments (and creating a syntax error with the second end comment):

/*/*setCaret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}*/*/

moveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

It only un-comments if the /* */ are not selected. I change selection to this (| are the selection boundaries):

/*/*|setCaret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}|*/*/

moveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

Press Ctrl+/ and I get this:

/*se|tCaret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}*/|

moveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

Then without changing the selection hit Ctrl+/ again, and the selection range is messed up even more:

setC|aret(pos) {
	this.selectionStart = this.selectionEnd = pos;
}

m|oveCaret(chars) {
	if (chars) {
		this.setCaret(this.selectionEnd + chars);
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions