Get scroll keyframes

@param array $lines
@param string $enter_from
@param string $exit_to

@return array
435032
public function scroll($lines, $enter_from, $exit_to)
    {
        $keyframes   = $this->enterFrom($lines, $enter_from);
        $keyframes   = array_merge($keyframes, $this->exitTo($lines, $exit_to));
        $keyframes   = array_unique($keyframes, SORT_REGULAR);
        $keyframes[] = reset($keyframes);

        return $keyframes;
    }
1012743
function(lines) {
		let output = [];
		let newlineCount = 0;
		for (let i = 0; i < lines.length; i++) {
			const line = lines[i];
			if (!line.trim()) {
				newlineCount++;
			} else {
				newlineCount = 0;
			}

			if (newlineCount >= 2) continue;

			output.push(line);
		}
		return output;
	}
676881
def scroll(self, lines):
        
        line = [(ord(u" "), Screen.COLOUR_WHITE, 0, 0, 1) for _ in range(self._width)]
        if lines > 0:
            # Limit to buffer size - this will just invalidate all the data
            lines = min(lines, self._height)
            for y in range(0, self._height - lines):
                self._double_buffer[y] = self._double_buffer[y + lines]
                self._screen_buffer[y] = self._screen_buffer[y + lines]
            for y in range(self._height - lines, self._height):
                self._double_buffer[y] = line[:]
                self._screen_buffer[y] = line[:]
        else:
            # Limit to buffer size - this will just invalidate all the data
            lines = max(lines, -self._height)
            for y in range(0, -lines):
                self._double_buffer[self._height + lines + y] = line[:]
                self._screen_buffer[y] = line[:]
            for y in range(self._height - 1, -lines, -1):
                self._double_buffer[y] = self._double_buffer[y + lines]
                self._screen_buffer[y] = self._screen_buffer[y + lines]
350894
def blocks(self, lines):
        """"""
        state = markdown.blockparser.State()
        blocks = []

        # We use three states: start, ``` and '\n'
        state.set('start')

        # index of current block
        currblock = 0

        for line in lines:
            line += '\n'
            if state.isstate('start'):
                if line[:3] == '```':
                    state.set('```')
                else:
                    state.set('\n')
                blocks.append('')
                currblock = len(blocks) - 1
            else:
                marker = line[:3]  # Will capture either '\n' or '```'
                if state.isstate(marker):
                    state.reset()
            blocks[currblock] += line

        return blocks
671942
def jump_to_line l
    l = l.clamp 0, lines - 1
    return if @topline == l
    @topline = l
    @botline = [l + buffer.content_height, lines].min
    buffer.mark_dirty
  end
552942
def get_lines(data_nts, prtfmt=None, nt_fields=None, **kws):
    """"""
    lines = []
    # optional keyword args: prt_if sort_by
    if prtfmt is None:
        prtfmt = mk_fmtfld(data_nts[0], kws.get('joinchr', ' '), kws.get('eol', '\n'))
    # if nt_fields arg is None, use fields from prtfmt string.
    if nt_fields is not None:
        _chk_flds_fmt(nt_fields, prtfmt)
    if 'sort_by' in kws:
        data_nts = sorted(data_nts, key=kws['sort_by'])
    prt_if = kws.get('prt_if', None)
    for data_nt in data_nts:
        if prt_if is None or prt_if(data_nt):
            lines.append(prtfmt.format(**data_nt._asdict()))
    return lines
76871
protected function getDirectionFrames($direction, array $lines, $line_method)
    {
        $mapping = [
            'exitHorizontalFrames' => ['left', 'right'],
            'exitVerticalFrames'   => ['top', 'bottom'],
        ];

        foreach ($mapping as $method => $directions) {
            if (in_array($direction, $directions)) {
                return $this->$method($lines, $line_method);
            }
        }

        // Fail gracefully, simply return an array
        return [];
    }
1344656
def extract_blocks( lines )
      init_doc_lines = lines.each_index.select{ |i| lines[i].include? "=begin" }
      end_doc_lines = lines.each_index.select{ |i| lines[i].include? "=end" }

      blocks = init_doc_lines.each_index.map do |i|
        { :init => init_doc_lines[i], :end => end_doc_lines[i] }
      end
    end
356867
public function getMigrationScripts(int $from, int $to, array $skipScripts = []): array
    {
        $migrationScripts = [];
        $provider = MigrationsStateProvider::getProvider();
        foreach ($this->migrationScripts as $scriptClass) {
            $migrationScript = new $scriptClass();
            if (!is_a($migrationScript, MigrationScriptInterface::class)) {
                throw new \Error('Non-MigrationScriptInterface object provided to MigrationManager: `' . $migrationScript.'`');
            }
            if (
                $migrationScript->version() < $from
                || $migrationScript->version() > $to
                || array_search($scriptClass, $skipScripts) !== false
            ) {
                continue;
            }
            if ($provider->isScriptComplete($scriptClass)) {
                continue;
            }
            $migrationScripts[] = $migrationScript;
        }
        usort($migrationScripts, function (MigrationScriptInterface $a, MigrationScriptInterface $b) {
            return $a->version() <=> $b->version();
        });

        return $migrationScripts;
    }
1011378
protected function exitHorizontalFrames(array $lines, $line_method)
    {
        $keyframes = [];
        $length    = mb_strlen($lines[0]);

        for ($i = $length; $i > 0; $i--) {
            $keyframes[] = $this->getHorizontalKeyframe($lines, $i, $line_method, $length);
        }

        return $keyframes;
    }
334575
public static function indentLines($lines, $indent = '  ')
    {
        $lineSeparator = "\n";
        $buffer        = '';
        $line          = strtok($lines, $lineSeparator);
        while ($line) {
            $buffer .= $indent . $line . $lineSeparator;
            $line = strtok($lineSeparator);
        }
        strtok(null, null);

        return $buffer;
    }
219774
function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  var common = from && to ? getLowestCommonAncestor(from, to) : null;
  var pathFrom = [];
  while (from && from !== common) {
    pathFrom.push(from);
    from = getParent(from);
  }
  var pathTo = [];
  while (to && to !== common) {
    pathTo.push(to);
    to = getParent(to);
  }
  var i;
  for (i = 0; i < pathFrom.length; i++) {
    fn(pathFrom[i], 'bubbled', argFrom);
  }
  for (i = pathTo.length; i-- > 0;) {
    fn(pathTo[i], 'captured', argTo);
  }
}
74218
protected function getLeadingLinePointer(File $phpcsFile, $fromStackPtr, $toStackPtr)
    {
        $tokens         = $phpcsFile->getTokens();
        $fromToken      = $tokens[$fromStackPtr];
        $prevCommentPtr = $phpcsFile->findPrevious(
            T_COMMENT,
            ($fromStackPtr - 1),
            $toStackPtr
        );

        if ($prevCommentPtr === false) {
            return $fromStackPtr;
        }

        $prevCommentToken = $tokens[$prevCommentPtr];

        if ($prevCommentToken['line'] === ($fromToken['line'] - 1)
            && $prevCommentToken['column'] === $fromToken['column']
        ) {
            return $prevCommentPtr;
        }

        return $fromStackPtr;
    }
168909
@Override
    public void scrollLines(int firstLine, int lastLine, int distance) {
        getBackBuffer().scrollLines(firstLine, lastLine, distance);
    }
908543
def get_lines(self, key):
        """"""
        if key in self._indices:
            return self._indices[key].values()
        else:
            return []
595399
protected function currentBottomLine($lines, $total_lines, $current)
    {
        $keyframe = array_fill(0, $total_lines - $current, '');

        return array_merge($keyframe, array_slice($lines, 0, $current));
    }
471499
public function exitTo($direction)
    {
        $this->setupKeyframes();

        $this->animate($this->keyframes->exitTo($this->getLines(), $direction));
    }