Editor: keep selections sorted and use an index for the main one
DynamicSelectionList: optimize updating on buffer modification

Now that we know selections are sorted, we can get the set of selections
needing updating in log(n) time using a binary search, for modification
not changing the line count, this makes updating selections run in log(n)
instead of n.
Buffer: optimize do_insert to minimize changes in m_lines vector