src/nvim/screen.c
/// Set dimensions of the Nvim application "shell".
Set dimensions of the Nvim application "shell".
Set dimensions of the Nvim application " shell " .
void screen_resize(int width, int height)
{
  static int busy = FALSE;
  if (updating_screen || busy) {
    return;
  }
  if (width < 0 || height < 0)      
    return;
  if (State == HITRETURN || State == SETWSIZE) {
    State = SETWSIZE;
    return;
  }
  if (curwin->w_buffer == NULL)
    return;
  ++busy;
  Rows = height;
  Columns = width;
  check_shellsize();
  height = Rows;
  width = Columns;
  p_lines = Rows;
  p_columns = Columns;
  ui_call_grid_resize(1, width, height);
  send_grid_resize = true;
  if (State != ASKMORE && State != EXTERNCMD && State != CONFIRM) {
    screenclear();
  }
  if (starting != NO_SCREEN) {
    maketitle();
    changed_line_abv_curs();
    invalidate_botline();
    if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM
        || exmode_active) {
      screenalloc();
      if (msg_grid.chars) {
        msg_grid_validate();
      }
      ui_comp_set_screen_valid(true);
      repeat_message();
    } else {
      if (curwin->w_p_scb)
        do_check_scrollbind(TRUE);
      if (State & CMDLINE) {
        redraw_popupmenu = false;
        update_screen(NOT_VALID);
        redrawcmdline();
        if (pum_drawn()) {
          cmdline_pum_display(false);
        }
      } else {
        update_topline();
        if (pum_drawn()) {
          redraw_popupmenu = false;
          ins_compl_show_pum();
        }
        update_screen(NOT_VALID);
        if (redrawing()) {
          setcursor();
        }
      }
    }
    ui_flush();
  }
  busy--;
}
void screen_resize ( int width , int height ) { static int busy = FALSE ; if ( updating_screen || busy ) { return ; } if ( width < 0 || height < 0 ) return ; if ( State == HITRETURN || State == SETWSIZE ) { State = SETWSIZE ; return ; } if ( curwin -> w_buffer == NULL ) return ; ++ busy ; Rows = height ; Columns = width ; check_shellsize ( ) ; height = Rows ; width = Columns ; p_lines = Rows ; p_columns = Columns ; ui_call_grid_resize ( 1 , width , height ) ; send_grid_resize = true ; if ( State != ASKMORE && State != EXTERNCMD && State != CONFIRM ) { screenclear ( ) ; } if ( starting != NO_SCREEN ) { maketitle ( ) ; changed_line_abv_curs ( ) ; invalidate_botline ( ) ; if ( State == ASKMORE || State == EXTERNCMD || State == CONFIRM || exmode_active ) { screenalloc ( ) ; if ( msg_grid . chars ) { msg_grid_validate ( ) ; } ui_comp_set_screen_valid ( true ) ; repeat_message ( ) ; } else { if ( curwin -> w_p_scb ) do_check_scrollbind ( TRUE ) ; if ( State & CMDLINE ) { redraw_popupmenu = false ; update_screen ( NOT_VALID ) ; redrawcmdline ( ) ; if ( pum_drawn ( ) ) { cmdline_pum_display ( false ) ; } } else { update_topline ( ) ; if ( pum_drawn ( ) ) { redraw_popupmenu = false ; ins_compl_show_pum ( ) ; } update_screen ( NOT_VALID ) ; if ( redrawing ( ) ) { setcursor ( ) ; } } } ui_flush ( ) ; } busy -- ; }
Set dimensions of the Nvim application "shell".
Set dimensions of the Nvim application " shell " .
// Avoid recursiveness, can happen when setting the window size causes // another window-changed signal. /* just checking... */ /* postpone the resizing */ /* curwin->w_buffer can be NULL when we are closing a window and the
   * buffer has already been closed and removing a scrollbar causes a resize
   * event. Don't resize then, it will happen after entering another buffer.
   */ /* The window layout used to be adjusted here, but it now happens in
   * screenalloc() (also invoked from screenclear()).  That is because the
   * "busy" check above may skip this, but not screenalloc(). */ /*
     * We only redraw when it's needed:
     * - While at the more prompt or executing an external command, don't
     *   redraw, but position the cursor.
     * - While editing the command line, only redraw that.
     * - in Ex mode, don't redraw anything.
     * - Otherwise, redraw right now, and position the cursor.
     * Always need to call update_screen() or screenalloc(), to make
     * sure Rows/Columns and the size of the screen is correct!
     */ // TODO(bfredl): sometimes messes up the output. Implement clear+redraw // also for the pager? (or: what if the pager was just a modal window?) // TODO(bfredl): ins_compl_show_pum wants to redraw the screen first. // For now make sure the nested update_screen(0) won't redraw the // pum at the old position. Try to untangle this later.