Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tshino committed Nov 21, 2021
1 parent 2dce2bf commit 4e609d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/internal_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ const internalCommands = (function() {
const selectionLength = args.selectionLength || 0;

if (Array.isArray(characterDelta)) {
// Splitting motion
// Each cursor splits into n cursors and goes to locations specified by the args.
const n = characterDelta.length;
if (!Array.isArray(lineDelta)) {
lineDelta = Array(n).fill(lineDelta);
Expand All @@ -105,6 +107,8 @@ const internalCommands = (function() {
});
textEditor.selections = newSelections;
} else {
// Unifor motion
// Each cursor moves with the same delta specified by the args.
const newSelections = Array.from(textEditor.selections).map(sel => {
const start = translate(document, sel.start, lineDelta, characterDelta);
const end = translate(document, start, 0, selectionLength);
Expand Down

0 comments on commit 4e609d1

Please sign in to comment.