CursorPositionCol returns the current column. (0-based.)
()
| 312 | |
| 313 | // CursorPositionCol returns the current column. (0-based.) |
| 314 | func (d *Document) CursorPositionCol() (col int) { |
| 315 | // Don't use self.text_before_cursor to calculate this. Creating substrings |
| 316 | // and splitting is too expensive for getting the cursor position. |
| 317 | _, index := d.findLineStartIndex(d.cursorPosition) |
| 318 | col = d.cursorPosition - index |
| 319 | return |
| 320 | } |
| 321 | |
| 322 | // GetCursorLeftPosition returns the relative position for cursor left. |
| 323 | func (d *Document) GetCursorLeftPosition(count int) int { |