mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-11 01:51:00 +00: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:
parent
bd0fa7b6c2
commit
3080e32a8f
1 changed files with 1 additions and 1 deletions
|
|
@ -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})
|
||||
|
|
|
|||
Loading…
Reference in a new issue