Repository: neovim/neovim
File: src/nvim/tui/tui.c (C)

Code before:
      ELOG("uv_tty_set_mode failed: %s", uv_strerror(ret));
    }
  }
#endif
  tui_set_mode(tui, (ModeShape)mode_idx);
  if (tui->is_starting) {
    if (tui->verbose >= 3) {
      show_verbose_terminfo(tui);
    }
  }
  tui->is_starting = false;  // mode entered, no longer starting
  tui->showing_mode = (ModeShape)mode_idx;
}

void tui_grid_scroll(TUIData *tui, Integer g, Integer startrow, Integer endrow, Integer startcol,
                     Integer endcol, Integer rows, Integer cols FUNC_ATTR_UNUSED)
{
  UGrid *grid = &tui->grid;
  int top = (int)startrow;
  int bot = (int)endrow - 1;
  int left = (int)startcol;
  int right = (int)endcol - 1;

  bool fullwidth = left == 0 && right == tui->width - 1;
  bool full_screen_scroll = fullwidth
                                      && top == 0 && bot == tui->height - 1;

  ugrid_scroll(grid, top, bot, left, right, (int)rows);

  bool can_scroll = tui->can_scroll
                    && (full_screen_scroll
                        || (tui->can_change_scroll_region
                            && ((left == 0 && right == tui->width - 1)
                                || tui->can_set_lr_margin
                                || tui->can_set_left_right_margin)));

  if (can_scroll) {
    // Change terminal scroll region and move cursor to the top
    if (!full_screen_scroll) {
      set_scroll_region(tui, top, bot, left, right);
    }
    cursor_goto(tui, top, left);
    update_attrs(tui, 0);

    if (rows > 0) {
      if (rows == 1) {
        unibi_out(tui, unibi_delete_line);
      } else {
        UNIBI_SET_NUM_VAR(tui->params[0], (int)rows);
        unibi_out(tui, unibi_parm_delete_line);
      }

Review comment (suggestion):
```suggestion
  bool full_screen_scroll = fullwidth && top == 0 && bot == tui->height - 1;
```

Code after:
      ELOG("uv_tty_set_mode failed: %s", uv_strerror(ret));
    }
  }
#endif
  tui_set_mode(tui, (ModeShape)mode_idx);
  if (tui->is_starting) {
    if (tui->verbose >= 3) {
      show_verbose_terminfo(tui);
    }
  }
  tui->is_starting = false;  // mode entered, no longer starting
  tui->showing_mode = (ModeShape)mode_idx;
}

void tui_grid_scroll(TUIData *tui, Integer g, Integer startrow, Integer endrow, Integer startcol,
                     Integer endcol, Integer rows, Integer cols FUNC_ATTR_UNUSED)
{
  UGrid *grid = &tui->grid;
  int top = (int)startrow;
  int bot = (int)endrow - 1;
  int left = (int)startcol;
  int right = (int)endcol - 1;

  bool fullwidth = left == 0 && right == tui->width - 1;
  bool full_screen_scroll = fullwidth && top == 0 && bot == tui->height - 1;

  ugrid_scroll(grid, top, bot, left, right, (int)rows);

  bool can_scroll = tui->can_scroll
                    && (full_screen_scroll
                        || (tui->can_change_scroll_region
                            && ((left == 0 && right == tui->width - 1)
                                || tui->can_set_lr_margin
                                || tui->can_set_left_right_margin)));

  if (can_scroll) {
    // Change terminal scroll region and move cursor to the top
    if (!full_screen_scroll) {
      set_scroll_region(tui, top, bot, left, right);
    }
    cursor_goto(tui, top, left);
    update_attrs(tui, 0);

    if (rows > 0) {
      if (rows == 1) {
        unibi_out(tui, unibi_delete_line);
      } else {
        UNIBI_SET_NUM_VAR(tui->params[0], (int)rows);
        unibi_out(tui, unibi_parm_delete_line);
      }
    } else {