marijnh/CodeMirror — pull request #2489 by njx (2014-04-22 00:57:17+00:00)
Title: Clip to valid pos when creating rectangular selection

Fixes #2488. The problem is that the new pos in the `forRect` case wasn't being clipped, and in this case `ch` was becoming negative.

It doesn't seem like all the `clipPos()` logic is necessary in this case, but it seemed like the simplest fix.