It seems like this logic (this diff plus the one just above it) wouldn't catch cases where a CoffeeScript-type block comment is embedded in between contiguous sets of line comments.  The first line of the selection could be "#", and the while loop here could terminate on a "#", but some of the lines in between could be "###" -- the loop would continue past them because they do match lineExp too.