Exemple #1
0
func moveDotUp(ed *Editor) {
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	if sol == 0 {
		ed.flash()
	}
	prevEOL := sol - 1
	prevSOL := strutil.FindLastSOL(ed.line[:prevEOL])
	width := WcWidths(ed.line[sol:ed.dot])
	ed.dot = prevSOL + len(TrimWcWidth(ed.line[prevSOL:prevEOL], width))
}
Exemple #2
0
func moveDotUp(ed *Editor, k Key) *leReturn {
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	if sol == 0 {
		ed.beep()
		return nil
	}
	prevEOL := sol - 1
	prevSOL := strutil.FindLastSOL(ed.line[:prevEOL])
	width := WcWidths(ed.line[sol:ed.dot])
	ed.dot = prevSOL + len(TrimWcWidth(ed.line[prevSOL:prevEOL], width))
	return nil
}
Exemple #3
0
func moveDotDown(ed *Editor) {
	eol := strutil.FindFirstEOL(ed.line[ed.dot:]) + ed.dot
	if eol == len(ed.line) {
		ed.flash()
	}
	nextSOL := eol + 1
	nextEOL := strutil.FindFirstEOL(ed.line[nextSOL:]) + nextSOL
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	width := WcWidths(ed.line[sol:ed.dot])
	ed.dot = nextSOL + len(TrimWcWidth(ed.line[nextSOL:nextEOL], width))
}
Exemple #4
0
func moveDotDown(ed *Editor, k Key) *leReturn {
	eol := strutil.FindFirstEOL(ed.line[ed.dot:]) + ed.dot
	if eol == len(ed.line) {
		ed.beep()
		return nil
	}
	nextSOL := eol + 1
	nextEOL := strutil.FindFirstEOL(ed.line[nextSOL:]) + nextSOL
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	width := WcWidths(ed.line[sol:ed.dot])
	ed.dot = nextSOL + len(TrimWcWidth(ed.line[nextSOL:nextEOL], width))
	return nil
}
Exemple #5
0
func killLineLeft(ed *Editor) {
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	ed.line = ed.line[:sol] + ed.line[ed.dot:]
	ed.dot = sol
}
Exemple #6
0
func moveDotSOL(ed *Editor) {
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	ed.dot = sol
}
Exemple #7
0
func killLineLeft(ed *Editor, k Key) *leReturn {
	sol := strutil.FindLastSOL(ed.line[:ed.dot])
	ed.line = ed.line[:sol] + ed.line[ed.dot:]
	ed.dot = sol
	return nil
}