MCPcopy
hub / github.com/micro-editor/micro / CursorRight

Method CursorRight

internal/action/actions.go:302–325  ·  view source on GitHub ↗

CursorRight moves the cursor right

()

Source from the content-addressed store, hash-verified

300
301// CursorRight moves the cursor right
302func (h *BufPane) CursorRight() bool {
303 if h.Cursor.HasSelection() {
304 h.Cursor.Deselect(false)
305 } else {
306 tabstospaces := h.Buf.Settings["tabstospaces"].(bool)
307 tabmovement := h.Buf.Settings["tabmovement"].(bool)
308 if tabstospaces && tabmovement {
309 tabsize := int(h.Buf.Settings["tabsize"].(float64))
310 line := h.Buf.LineBytes(h.Cursor.Y)
311 if h.Cursor.X+tabsize < util.CharacterCount(line) && util.IsSpaces(line[h.Cursor.X:h.Cursor.X+tabsize]) && util.IsBytesWhitespace(line[0:h.Cursor.X]) {
312 for i := 0; i < tabsize; i++ {
313 h.Cursor.Right()
314 }
315 } else {
316 h.Cursor.Right()
317 }
318 } else {
319 h.Cursor.Right()
320 }
321 }
322
323 h.Relocate()
324 return true
325}
326
327// WordRight moves the cursor one word to the right
328func (h *BufPane) WordRight() bool {

Callers

nothing calls this directly

Calls 8

CharacterCountFunction · 0.92
IsSpacesFunction · 0.92
IsBytesWhitespaceFunction · 0.92
RightMethod · 0.80
LineBytesMethod · 0.65
RelocateMethod · 0.65
HasSelectionMethod · 0.45
DeselectMethod · 0.45

Tested by

no test coverage detected