CursorLeft moves the cursor left
()
| 275 | |
| 276 | // CursorLeft moves the cursor left |
| 277 | func (h *BufPane) CursorLeft() bool { |
| 278 | if h.Cursor.HasSelection() { |
| 279 | h.Cursor.Deselect(true) |
| 280 | } else { |
| 281 | tabstospaces := h.Buf.Settings["tabstospaces"].(bool) |
| 282 | tabmovement := h.Buf.Settings["tabmovement"].(bool) |
| 283 | if tabstospaces && tabmovement { |
| 284 | tabsize := int(h.Buf.Settings["tabsize"].(float64)) |
| 285 | line := h.Buf.LineBytes(h.Cursor.Y) |
| 286 | if h.Cursor.X-tabsize >= 0 && util.IsSpaces(line[h.Cursor.X-tabsize:h.Cursor.X]) && util.IsBytesWhitespace(line[0:h.Cursor.X-tabsize]) { |
| 287 | for i := 0; i < tabsize; i++ { |
| 288 | h.Cursor.Left() |
| 289 | } |
| 290 | } else { |
| 291 | h.Cursor.Left() |
| 292 | } |
| 293 | } else { |
| 294 | h.Cursor.Left() |
| 295 | } |
| 296 | } |
| 297 | h.Relocate() |
| 298 | return true |
| 299 | } |
| 300 | |
| 301 | // CursorRight moves the cursor right |
| 302 | func (h *BufPane) CursorRight() bool { |
nothing calls this directly
no test coverage detected