src/language-yaml/utils.js/splitWithSingleSpace
function splitWithSingleSpace(text) {
  const parts = [];

  let lastPart;
  for (const part of text.split(/( +)/g)) {
    /* istanbul ignore else */
    if (part !== " ") {
      if (lastPart === " ") {
        parts.push(part);
      } else {
        parts.push((parts.pop() || "") + part);
      }
    } else if (lastPart === undefined) {
      parts.unshift("");
    }

    lastPart = part;
  }

  /* istanbul ignore next */
  if (lastPart === " ") {
    parts.push((parts.pop() || "") + " ");
  }

  if (parts[0] === "") {
    parts.shift();
    parts.unshift(" " + (parts.shift() || ""));
  }

  return parts;
}