src/nvim/screen.c
/// delete lines on the screen and move lines up.
/// 'end' is the line after the scrolled part. Normally it is Rows.
/// When scrolling region used 'off' is the offset from the top for the region.
/// 'row' and 'end' are relative to the start of the region.
delete lines on the screen and move lines up.
'end' is the line after the scrolled part. Normally it is Rows.
When scrolling region used 'off' is the offset from the top for the region.
'row' and 'end' are relative to the start of the region.
delete lines on the screen and move lines up . ' end ' is the line after the scrolled part . Normally it is Rows . When scrolling region used ' off ' is the offset from the top for the region . ' row ' and ' end ' are relative to the start of the region .
void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
                    int width)
{
  int j;
  int i;
  unsigned temp;
  int row_off = 0;
  screen_adjust_grid(&grid, &row_off, &col);
  row += row_off;
  end += row_off;
  if (line_count <= 0) {
    return;
  }
  for (i = 0; i < line_count; i++) {
    if (width != grid->Columns) {
      j = row + i;
      while ((j += line_count) <= end - 1) {
        linecopy(grid, j - line_count, j, col, width);
      }
      j -= line_count;
      grid_clear_line(grid, grid->line_offset[j] + col, width, false);
      grid->line_wraps[j] = false;
    } else {
      j = row + i;
      temp = grid->line_offset[j];
      while ((j += line_count) <= end - 1) {
        grid->line_offset[j - line_count] = grid->line_offset[j];
        grid->line_wraps[j - line_count] = grid->line_wraps[j];
      }
      grid->line_offset[j - line_count] = temp;
      grid->line_wraps[j - line_count] = false;
      grid_clear_line(grid, temp, (int)grid->Columns, false);
    }
  }
  if (!grid->throttled) {
    ui_call_grid_scroll(grid->handle, row, end, col, col+width, line_count, 0);
  }
  return;
}
void grid_del_lines ( ScreenGrid * grid , int row , int line_count , int end , int col , int width ) { int j ; int i ; unsigned temp ; int row_off = 0 ; screen_adjust_grid ( & grid , & row_off , & col ) ; row += row_off ; end += row_off ; if ( line_count <= 0 ) { return ; } for ( i = 0 ; i < line_count ; i ++ ) { if ( width != grid -> Columns ) { j = row + i ; while ( ( j += line_count ) <= end - 1 ) { linecopy ( grid , j - line_count , j , col , width ) ; } j -= line_count ; grid_clear_line ( grid , grid -> line_offset [ j ] + col , width , false ) ; grid -> line_wraps [ j ] = false ; } else { j = row + i ; temp = grid -> line_offset [ j ] ; while ( ( j += line_count ) <= end - 1 ) { grid -> line_offset [ j - line_count ] = grid -> line_offset [ j ] ; grid -> line_wraps [ j - line_count ] = grid -> line_wraps [ j ] ; } grid -> line_offset [ j - line_count ] = temp ; grid -> line_wraps [ j - line_count ] = false ; grid_clear_line ( grid , temp , ( int ) grid -> Columns , false ) ; } } if ( ! grid -> throttled ) { ui_call_grid_scroll ( grid -> handle , row , end , col , col + width , line_count , 0 ) ; } return ; }
delete lines on the screen and move lines up.
delete lines on the screen and move lines up .
// Now shift line_offset[] line_count up to reflect the deleted lines. // Clear the inserted lines. // need to copy part of a line // whole width, moving the line pointers is faster