Add convenient event methods to all event-emitting objects

i.e. linehandle.on, markedrange.off, etc.
[activeline addon] Don't get confused by collapsed spans

Issue #1668