Improve remove performance

This commit is contained in:
Zachary Yedidia
2020-02-09 14:58:37 -05:00
parent ca9d102267
commit 8ddf335e68
3 changed files with 18 additions and 15 deletions

View File

@@ -139,7 +139,7 @@ func ByteOffset(pos Loc, buf *Buffer) int {
// clamps a loc within a buffer
func clamp(pos Loc, la *LineArray) Loc {
if pos.GreaterEqual(la.End()) {
return la.End().MoveLA(-1, la)
return la.End()
} else if pos.LessThan(la.Start()) {
return la.Start()
}