fix text selection within a document https://github.com/epha/kompendium/issues/15