From 3752b0205f7c8fa762a3aecf6d01b6f7b892c51d Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Wed, 30 Jan 2013 19:20:53 +0100 Subject: [PATCH] Add to list of actions that enable multiple carets Selecting to begin/end of typing pairs or end of line/paragraph will now also break up a column selection into multiple carets. --- Frameworks/selection/src/selection.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Frameworks/selection/src/selection.cc b/Frameworks/selection/src/selection.cc index b5741aa4..c98baa12 100644 --- a/Frameworks/selection/src/selection.cc +++ b/Frameworks/selection/src/selection.cc @@ -874,8 +874,11 @@ namespace ng ranges_t extend (buffer_t const& buffer, ranges_t const& selection, select_unit_type const unit, layout_movement_t const* layout) { + static std::set const splittingUnits = { kSelectionExtendToWord, kSelectionExtendToTypingPair, kSelectionExtendToScope, kSelectionExtendToEndOfSoftLine, kSelectionExtendToEndOfIndentedLine, kSelectionExtendToEndOfLine, kSelectionExtendToEndOfParagraph, kSelectionExtendToBeginOfTypingPair, kSelectionExtendToEndOfTypingPair }; + bool shouldDissect = splittingUnits.find(unit) != splittingUnits.end(); + ranges_t res; - citerate(range, (unit == kSelectionExtendToWord || unit == kSelectionExtendToTypingPair || unit == kSelectionExtendToScope) ? dissect_columnar(buffer, selection) : selection) + citerate(range, shouldDissect ? dissect_columnar(buffer, selection) : selection) res.push_back(extend(buffer, *range, unit, layout)); return sanitize(buffer, res); }