Returns a line at the nearest row split between tests.

        Re-implemented from :meth:`AbstractDragView<sparkle.gui.abstract_drag_view.AbstractDragView.cursor>`
420860
def cursor(self, pos):
        
        row = self.indexAt(pos).row()
        if row == -1:
            row = self.model().rowCount()
        row_height = self.rowHeight(0)
        y = row_height*row
        x = self.width()
        return QtCore.QLine(0,y,x,y)
827064
def select_line(self):
        
        self.cursor.movePosition(self.cursor.StartOfBlock)
        text = self.cursor.block().text()
        lindent = len(text) - len(text.lstrip())
        self.cursor.setPosition(self.cursor.block().position() + lindent)
        self.cursor.movePosition(self.cursor.EndOfBlock,
                                 self.cursor.KeepAnchor)
1173510
def rows(self):
        
        with self.input().open('r') as fobj:
            for line in fobj:
                yield line.strip('\n').split('\t')
784865
def cursor_back(self, count=None):
        
        # Handle the case when we've just drawn in the last column
        # and would wrap the line on the next :meth:`draw()` call.
        if self.cursor.x == self.columns:
            self.cursor.x -= 1

        self.cursor.x -= count or 1
        self.ensure_hbounds()
408757
def dragMoveEvent(self, event):
        """"""
        super(AbstractDragView, self).dragMoveEvent(event)
        if event.mimeData().hasFormat("application/x-protocol"):
            # find the nearest break to cursor
            self.dragline = self.cursor(event.pos())
            self.viewport().update()
            event.setDropAction(QtCore.Qt.MoveAction)
            event.accept()
        else:
            event.ignore()
81136
def next_cursor_location(self):
        
        self._verify_entrypoint_selected()
        self.current_trace_frame_index = min(
            self.current_trace_frame_index + 1, len(self.trace_tuples) - 1
        )
        self.trace()
744018
private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) {
		
		S.Buffer rowBuilder = S.buffer();
		int colWidth;
		
		for (int i = 0 ; i < colCount ; i ++) {
			
			colWidth = colMaxLenList.get(i) + 3;
			
			for (int j = 0; j < colWidth ; j ++) {
				if (j==0) {
					rowBuilder.append("+");
				} else if ((i+1 == colCount && j+1 == colWidth)) {//for last column close the border
					rowBuilder.append("-+");
				} else {
					rowBuilder.append("-");
				}
			}
		}
		
		return rowBuilder.append("\n").toString();
	}
1306473
def get_curr_lines(self):
        
        start = max(0, self._coord.line - 5)
        end = min(len(self._template_lines), self._coord.line + 4)

        lines = [(x, self._template_lines[x]) for x in six.moves.range(start, end, 1)]
        return self._coord.line, lines
45122
def goto_prev_selection
      return if selected_rows().length == 0 
      row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index }
      row ||= @obj.current_index
      #@obj.current_index = row
      @obj.goto_line row
    end
270200
def cursor_to_line(self, line=None):
        
        self.cursor.y = (line or 1) - 1

        # If origin mode (DECOM) is set, line number are relative to
        # the top scrolling margin.
        if mo.DECOM in self.mode:
            self.cursor.y += self.margins.top

            # FIXME: should we also restrict the cursor to the scrolling
            # region?

        self.ensure_vbounds()
390329
def get_column_cursor_position(self, column):
        
        line_length = len(self.current_line)
        current_column = self.cursor_position_col
        column = max(0, min(line_length, column))

        return column - current_column
808805
@Override
    public Row nextRow() {
        if (nextRow == null) {
            // Didn't call 'hasNext()' ...
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
        }
        assert nextRow != null;
        Row result = nextRow;
        nextRow = null;
        position++;
        return result;
    }
1091477
def first_(self):
        
        try:
            val = self.df.iloc[0]
            return val
        except Exception as e:
            self.err(e, "Can not select first row")
217183
def selection_range(self):  # XXX: shouldn't this return `None` if there is no selection???
        
        if self.selection:
            from_, to = sorted([self.cursor_position, self.selection.original_cursor_position])
        else:
            from_, to = self.cursor_position, self.cursor_position

        return from_, to
1326229
def _produce_return(self, cursor):
        
        rowcount = cursor.rowcount

        # Check the row count?
        if self._rowcount is not None and self._rowcount != rowcount:
            raise ManipulationCheckError(
                "Count was {}, expected {}.".format(rowcount, self._rowcount))

        return rowcount
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)
1317704
public CursorLocation locate(int index, int width) {
        // Upper lines location has been lost.
        if (isLocationInvalidated()) {
            return null;
        }
        int cumulated = 0;

        List<Integer> allLines = new ArrayList<>();
        allLines.addAll(linesSize);
        allLines.add(buffer.length());
        allLines.add(buffer.prompt().getLength());
        int lineIndex = 0;
        for (int i = 0; i < allLines.size(); i++) {
            int cmdSize = allLines.get(i++);
            int promptSize = allLines.get(i);
            lineIndex += 1;
            if (cumulated + cmdSize > index) {
                int part = index - cumulated;
                int col = (part + promptSize) % width;
                // if the part + prompt is longer than width, then
                // the row is in a lower line.
                lineIndex += (promptSize + part) / width;
                return new CursorLocation(lineIndex - 1, col);
            }
            cumulated += cmdSize;
            // Each line could be wrapped if longer than width.
            lineIndex += (cmdSize + promptSize) / width;
        }
        // we are on the last line at the last character.
        if (cumulated == index) {
            int cmdSize = allLines.get(allLines.size() - 2);
            int promptSize = allLines.get(allLines.size() - 1);
            int col = (cmdSize + promptSize) % width;
            return new CursorLocation(lineIndex - 1, col);
        } else {
            return null;
        }
    }