Go to the previous cell of lines
357985
def go_to_previous_cell(self):
        """"""
        cursor = self.textCursor()
        cur_pos = prev_pos = cursor.position()

        if self.is_cell_separator(cursor):
            # Move to the previous cell
            cursor.movePosition(QTextCursor.PreviousBlock)
            cur_pos = prev_pos = cursor.position()

        while not self.is_cell_separator(cursor):
            # Move to the previous cell or the beginning of the current cell
            cursor.movePosition(QTextCursor.PreviousBlock)
            prev_pos = cur_pos
            cur_pos = cursor.position()
            if cur_pos == prev_pos:
                return

        self.setTextCursor(cursor)
1207941
def erase_down (self): # <ESC>[0J -or- <ESC>[J
        ''''''

        self.erase_end_of_line ()
        self.fill_region (self.cur_r + 1, 1, self.rows, self.cols)
790938
def newline(self):
        """"""
        self.write(self.term.move_down)
        self.write(self.term.clear_bol)
776209
function(cells, ascending)
	{
		ascending = (ascending != null) ? ascending : true;
		var lookup = new mxDictionary();
		cells.sort(function(o1, o2)
		{
			var p1 = lookup.get(o1);
			
			if (p1 == null)
			{
				p1 = mxCellPath.create(o1).split(mxCellPath.PATH_SEPARATOR);
				lookup.put(o1, p1);
			}
			
			var p2 = lookup.get(o2);
			
			if (p2 == null)
			{
				p2 = mxCellPath.create(o2).split(mxCellPath.PATH_SEPARATOR);
				lookup.put(o2, p2);
			}
			
			var comp = mxCellPath.compare(p1, p2);
			
			return (comp == 0) ? 0 : (((comp > 0) == ascending) ? 1 : -1);
		});
		
		return cells;
	}
386445
function(){
      if (this._cellset) this._cellset.reset();
      if (this._axes) {
        var i, n, axis;
        for (i = 0, n = this.axisCount(); i < n; i++){
            this.getAxis(i).reset();
        }
      }
    }
232811
def cells(self):
        '''
        '''
        for line in self.text.splitlines():
            for cell in self.getcells(line):
                yield cell
47654
def advance_cell(self, reverse=False):
        
        if not reverse:
            move_func = self.get_current_editor().go_to_next_cell
        else:
            move_func = self.get_current_editor().go_to_previous_cell

        if self.focus_to_editor:
            move_func()
        else:
            term = QApplication.focusWidget()
            move_func()
            term.setFocus()
            term = QApplication.focusWidget()
            move_func()
            term.setFocus()
801433
private void skipToEndOfLine() {
		for (; this.pos < this.in.length(); this.pos++) {
			char c = this.in.charAt(this.pos);
			if (c == '\r' || c == '\n') {
				this.pos++;
				break;
			}
		}
	}
817437
def getcells(self, line):
        '''
        '''
        for boundary in self.boundaries:
            cell = line.lstrip()[boundary].strip()
            if cell:
                for cell in re.split('\s{3,}', cell):
                    yield cell
            else:
                yield None
1264016
function advanceTo(newPos) {
		let n = newPos - pos
		assert(n >= 0)
		while (n--) {
			if (source[pos] === '\n') {
				column = 1
				line++
			} else {
				column++
			}
			pos += 1
		}
	}
785608
def move_to_start(self, column_label):
        """"""
        self._columns.move_to_end(column_label, last=False)
        return self
1183631
function (startCell, endCell, callback) {
      var result = {
        index: [], // list of cell index: A1, A2, A3
        value: []  // list of cell value
      };

      var cols = {
        start: 0,
        end: 0
      };

      if (endCell.col >= startCell.col) {
        cols = {
          start: startCell.col,
          end: endCell.col
        };
      } else {
        cols = {
          start: endCell.col,
          end: startCell.col
        };
      }

      var rows = {
        start: 0,
        end: 0
      };

      if (endCell.row >= startCell.row) {
        rows = {
          start: startCell.row,
          end: endCell.row
        };
      } else {
        rows = {
          start: endCell.row,
          end: startCell.row
        };
      }

      for (var column = cols.start; column <= cols.end; column++) {
        for (var row = rows.start; row <= rows.end; row++) {
          var cellIndex = instance.utils.toChar(column) + (row + 1),
              cellValue = instance.helper.cellValue.call(this, cellIndex);

          result.index.push(cellIndex);
          result.value.push(cellValue);
        }
      }

      if (instance.utils.isFunction(callback)) {
        return callback.apply(callback, [result]);
      } else {
        return result;
      }
    }
664590
def cell_ends_with_function_or_class(lines):
    """"""
    non_quoted_lines = []
    parser = StringParser('python')
    for line in lines:
        if not parser.is_quoted():
            non_quoted_lines.append(line)
        parser.read_line(line)

    # find the first line, starting from the bottom, that is not indented
    lines = non_quoted_lines[::-1]
    for i, line in enumerate(lines):
        if not line.strip():
            # two blank lines? we won't need to insert more blank lines below this cell
            if i > 0 and not lines[i - 1].strip():
                return False
            continue
        if line.startswith('#') or line.startswith(' '):
            continue
        if line.startswith('def ') or line.startswith('class '):
            return True
        return False

    return False
1060300
function incidence(from_cells, to_cells) {
  var index = new Array(from_cells.length)
  for(var i=0, il=index.length; i<il; ++i) {
    index[i] = []
  }
  var b = []
  for(var i=0, n=to_cells.length; i<n; ++i) {
    var c = to_cells[i]
    var cl = c.length
    for(var k=1, kn=(1<<cl); k<kn; ++k) {
      b.length = bits.popCount(k)
      var l = 0
      for(var j=0; j<cl; ++j) {
        if(k & (1<<j)) {
          b[l++] = c[j]
        }
      }
      var idx=findCell(from_cells, b)
      if(idx < 0) {
        continue
      }
      while(true) {
        index[idx++].push(i)
        if(idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {
          break
        }
      }
    }
  }
  return index
}
719173
function(node) {
    if (node) {
        this.start = {
            line: node.start.line,
            column: node.start.column
        };
        this.end = {
            line: node.end.line,
            column: node.end.column
        };
        this.offset = {
            start: node.start.offset,
            end: node.end.offset
        };
    }
}
1122473
def _go_to_line(editor, line):
    
    b = editor.application.current_buffer
    b.cursor_position = b.document.translate_row_col_to_index(max(0, int(line) - 1), 0)
857253
function(){
		var bd = this.board;
		for(var c=0;c<bd.cell.length;c++){
			var cell = bd.cell[c], adb = cell.adjborder;
			if( (!adb.top.isLine()    || !cell.noLP(cell.UP)) &&
				(!adb.bottom.isLine() || !cell.noLP(cell.DN)) &&
				(!adb.left.isLine()   || !cell.noLP(cell.LT)) &&
				(!adb.right.isLine()  || !cell.noLP(cell.RT)) )
			{ continue;}
		
			this.failcode.add("ceAddLine");
			if(this.checkOnly){ break;}
			cell.seterr(1);
		}
	}