code: function rebaseHistSel(pos, from, to, diff) {
      if (to < pos.line) {
        pos.line += diff;
      } else if (from < pos.line) {
        pos.line = from;
        pos.ch = 0;
      }
    }
docs: Rebasing/resetting history to deal with externally-sourced changes