Sublime Forum

Bug in "Expand selection to scope" in PHP

#1

Consider the following bit of C code:

#include <stdio.h>
int main(int argc, char** argv)
{
	if (1 == 1) {
		printf("yes\n");
	} else {
		printf("no\n");
	}
}

Put point on the “printf” in the else branch of the conditional. Do “Expand selection to scope”. It highlights the printf. Again. It highlights the else part of the conditional. Again. It highlights the body of the function. Good.

Now consider the following bit of PHP code:

<?php

function foo()
{
	if (1 == 1) {
		echo("yes\n");
	} else {
		echo("no\n");
	}
}

Put point on the “echo” in the else branch. Do “Expand selection to scope”. It highlights the “echo”. Good. Again. It highlights from start of file to the end of the string “no\n”!?!? Very weird.

If I do the same thing in the “if” leg, then it highlights from the start of the file until the end of the string “yes\n”, which was half-expected.

Using build 2139.

0 Likes

#2

I tried build 2152 which exhibits the same misbehavior.

0 Likes