message: Make selection creation more robust (re: section shifting)
diff: @@ -602,6 +602,19 @@ export class Commander {
  const lines = someText.split(/\n/)
  return lines.slice(lines.length - 1, lines.length)[0].length
  }
  + function sortPositions(position1: vscode.Position, position2: vscode.Position) {
  + if (position1.line < position2.line) {
  + return [position1, position2]
  + } else if (position1.line > position2.line) {
  + return [position2, position1]
  + } else {
  + if (position2.character < position1.character) {
  + return [position2, position1]
  + } else {
  + return [position1, position2]
  + }
  + }
  + }
  const document = editor.document
  const selections = editor.selections
  @@ -619,11 +632,12 @@ export class Commander {
  const newText = selectionText.replace(pattern, replacer)
  edit.replace(document.uri, selection, newText)
  - const changeInEndLineLength = getLastLineLength(newText) - getLastLineLength(selectionText)
  + const changeInEndCharacterPosition = getLastLineLength(newText) - getLastLineLength(selectionText)
  + const [selectionStart, selectionEnd] = sortPositions(selection.anchor, selection.active)
  newSelections.push(
  - new vscode.Selection(selection.anchor,
  - new vscode.Position(selection.active.line,
  - selection.active.character + changeInEndLineLength
  + new vscode.Selection(selectionStart,
  + new vscode.Position(selectionEnd.line,
  + selectionEnd.character + changeInEndCharacterPosition
  )
  )
  )
  