mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 13:57:07 +09:00
Fix multiline remove in lineArray
I forgot that when you remove lines[n] then lines[n+1] becomes lines[n] so to remove the range lines[a:b] you need to remove lines[a] for a-b times. In this case we should delete lines[start.Y + 1] over and over instead of removing lines[i] because i is contantly increasing. Fixes #166
This commit is contained in:
@@ -92,7 +92,7 @@ func (la *LineArray) remove(start, end Loc) string {
|
||||
la.lines[start.Y] = append(la.lines[start.Y][:startX], la.lines[start.Y][endX:]...)
|
||||
} else {
|
||||
for i := start.Y + 1; i <= end.Y-1; i++ {
|
||||
la.DeleteLine(i)
|
||||
la.DeleteLine(start.Y + 1)
|
||||
}
|
||||
la.DeleteToEnd(Loc{startX, start.Y})
|
||||
la.DeleteFromStart(Loc{endX - 1, start.Y + 1})
|
||||
|
||||
Reference in New Issue
Block a user