refactored encloseSelection merged with enclosedLineSelection