Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline uncommenting acts weird, causes errors #31

Open
dragoncoder047 opened this issue Jun 24, 2022 · 0 comments
Open

Multiline uncommenting acts weird, causes errors #31

dragoncoder047 opened this issue Jun 24, 2022 · 0 comments

Comments

@dragoncoder047
Copy link

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);
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant