func moveDotUp(ed *Editor) { sol := util.FindLastSOL(ed.line[:ed.dot]) if sol == 0 { ed.flash() return } prevEOL := sol - 1 prevSOL := util.FindLastSOL(ed.line[:prevEOL]) width := WcWidths(ed.line[sol:ed.dot]) ed.dot = prevSOL + len(TrimWcWidth(ed.line[prevSOL:prevEOL], width)) }
func moveDotDown(ed *Editor) { eol := util.FindFirstEOL(ed.line[ed.dot:]) + ed.dot if eol == len(ed.line) { ed.flash() return } nextSOL := eol + 1 nextEOL := util.FindFirstEOL(ed.line[nextSOL:]) + nextSOL sol := util.FindLastSOL(ed.line[:ed.dot]) width := WcWidths(ed.line[sol:ed.dot]) ed.dot = nextSOL + len(TrimWcWidth(ed.line[nextSOL:nextEOL], width)) }
func killLineLeft(ed *Editor) { sol := util.FindLastSOL(ed.line[:ed.dot]) ed.line = ed.line[:sol] + ed.line[ed.dot:] ed.dot = sol }
func findLastIndent(s string) string { line := s[util.FindLastSOL(s):] trimmed := strings.TrimLeft(line, " \t") return line[:len(line)-len(trimmed)] }
func moveDotSOL(ed *Editor) { sol := util.FindLastSOL(ed.line[:ed.dot]) ed.dot = sol }