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.
This commit is contained in:
Allan Odgaard
2013-01-30 19:20:53 +01:00
parent 342152ea71
commit 3752b0205f

View File

@@ -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<select_unit_type> 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);
}