kisielk/vigo — pull request #31 by dtcaciuc (2014-06-01 19:18:13+00:00)
Title: Add dedicated Selection class; make view track active selection.

First of all, big thanks to @gchp for the initial work. I wish I thought about this stuff during the original review, rather than after the fact. I have not yet removed any code to simplify the review.

Selection gives us an abstraction over a couple of implementation details

* Selection can be more complex than a non-interrupted buffer range (eg. block selection; we'll likely need a list of ranges to implement this). Separating overall selection and resulting buffer range(s) concepts creates a nice point where we can take care of all the grizzly conversion details (see EffectiveRange()) For instance, selection works on inclusive ranges, while normally ranges are end-exclusive.
* Having view update the selection as cursor is moved around makes sure the two don't get out of sync and removes the need for separate adjustment commands.

The change also attempts to make more use of Cursor object as opposed to line/offset arguments. Working with cursors is useful because some routines rely on Line field (eg. ExtractBytes), which is otherwise absent.