()
| 361 | } |
| 362 | |
| 363 | func (buffer *Buffer) index() { |
| 364 | |
| 365 | // This sequence causes the active position to move downward one line without changing the column position. |
| 366 | // If the active position is at the bottom margin, a scroll up is performed." |
| 367 | |
| 368 | cursorVY := buffer.convertRawLineToViewLine(buffer.cursorPosition.Line) |
| 369 | |
| 370 | if buffer.InScrollableRegion() { |
| 371 | |
| 372 | if uint(cursorVY) < buffer.bottomMargin { |
| 373 | buffer.cursorPosition.Line++ |
| 374 | } else { |
| 375 | buffer.areaScrollUp(1) |
| 376 | } |
| 377 | |
| 378 | return |
| 379 | } |
| 380 | |
| 381 | if cursorVY >= buffer.ViewHeight()-1 { |
| 382 | buffer.lines = append(buffer.lines, newLine()) |
| 383 | maxLines := buffer.GetMaxLines() |
| 384 | if uint64(len(buffer.lines)) > maxLines { |
| 385 | copy(buffer.lines, buffer.lines[uint64(len(buffer.lines))-maxLines:]) |
| 386 | buffer.lines = buffer.lines[:maxLines] |
| 387 | } |
| 388 | } |
| 389 | buffer.cursorPosition.Line++ |
| 390 | } |
| 391 | |
| 392 | func (buffer *Buffer) reverseIndex() { |
| 393 |
no test coverage detected