For the index of a character at a certain line, calculate the index of the first character on that line.
(index int)
| 298 | // For the index of a character at a certain line, calculate the index of |
| 299 | // the first character on that line. |
| 300 | func (d *Document) findLineStartIndex(index int) (pos int, lineStartIndex int) { |
| 301 | indexes := d.lineStartIndexes() |
| 302 | pos = bisect.Right(indexes, index) - 1 |
| 303 | lineStartIndex = indexes[pos] |
| 304 | return |
| 305 | } |
| 306 | |
| 307 | // CursorPositionRow returns the current row. (0-based.) |
| 308 | func (d *Document) CursorPositionRow() (row int) { |
no test coverage detected