MoveLinesUp moves the range of lines up one row
(start int, end int)
| 1127 | |
| 1128 | // MoveLinesUp moves the range of lines up one row |
| 1129 | func (b *Buffer) MoveLinesUp(start int, end int) { |
| 1130 | if start < 1 || start >= end || end > len(b.lines) { |
| 1131 | return |
| 1132 | } |
| 1133 | l := string(b.LineBytes(start - 1)) |
| 1134 | if end == len(b.lines) { |
| 1135 | b.insert( |
| 1136 | Loc{ |
| 1137 | util.CharacterCount(b.lines[end-1].data), |
| 1138 | end - 1, |
| 1139 | }, |
| 1140 | []byte{'\n'}, |
| 1141 | ) |
| 1142 | } |
| 1143 | b.Insert( |
| 1144 | Loc{0, end}, |
| 1145 | l+"\n", |
| 1146 | ) |
| 1147 | b.Remove( |
| 1148 | Loc{0, start - 1}, |
| 1149 | Loc{0, start}, |
| 1150 | ) |
| 1151 | } |
| 1152 | |
| 1153 | // MoveLinesDown moves the range of lines down one row |
| 1154 | func (b *Buffer) MoveLinesDown(start int, end int) { |
nothing calls this directly
no test coverage detected