aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/term.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-01 21:00:20 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-12-02 07:15:06 -0300
commit05f8d261fe305741ea99c6da2096d890b1005bf7 (patch)
treed0e0f77facb117bb46bd17441b4499d463621bb3 /src/nvim/term.c
parent9ac2e8423a8118284b54cbf3586b57cb310acafa (diff)
downloadrneovim-05f8d261fe305741ea99c6da2096d890b1005bf7.tar.gz
rneovim-05f8d261fe305741ea99c6da2096d890b1005bf7.tar.bz2
rneovim-05f8d261fe305741ea99c6da2096d890b1005bf7.zip
term: Move "set_shellsize" to screen.c as "screen_resize"
Diffstat (limited to 'src/nvim/term.c')
-rw-r--r--src/nvim/term.c100
1 files changed, 2 insertions, 98 deletions
diff --git a/src/nvim/term.c b/src/nvim/term.c
index 9da7e11b96..47f7fa8af3 100644
--- a/src/nvim/term.c
+++ b/src/nvim/term.c
@@ -1472,7 +1472,7 @@ int set_termname(char_u *term)
width = 80;
height = 24; /* most terminals are 24 lines */
}
- set_shellsize(width, height, FALSE); /* may change Rows */
+ screen_resize(width, height, FALSE); /* may change Rows */
if (starting != NO_SCREEN) {
if (scroll_region)
scroll_region_reset(); /* In case Rows changed */
@@ -2289,7 +2289,7 @@ void win_new_shellsize(void)
*/
void shell_resized(void)
{
- set_shellsize(0, 0, FALSE);
+ screen_resize(0, 0, FALSE);
}
/*
@@ -2311,102 +2311,6 @@ void shell_resized_check(void)
}
/*
- * Set size of the Vim shell.
- * If 'mustset' is TRUE, we must set Rows and Columns, do not get the real
- * window size (this is used for the :win command).
- * If 'mustset' is FALSE, we may try to get the real window size and if
- * it fails use 'width' and 'height'.
- */
-void set_shellsize(int width, int height, int mustset)
-{
- static int busy = FALSE;
-
- /*
- * Avoid recursiveness, can happen when setting the window size causes
- * another window-changed signal.
- */
- if (busy)
- return;
-
- if (width < 0 || height < 0) /* just checking... */
- return;
-
- if (State == HITRETURN || State == SETWSIZE) {
- /* postpone the resizing */
- State = SETWSIZE;
- return;
- }
-
- /* 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.
- */
- if (curwin->w_buffer == NULL)
- return;
-
- ++busy;
-
-
- if (mustset || (ui_get_shellsize() == FAIL && height != 0)) {
- Rows = height;
- Columns = width;
- check_shellsize();
- mch_set_shellsize();
- } else
- check_shellsize();
-
- /* 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(). */
-
- if (State != ASKMORE && State != EXTERNCMD && State != CONFIRM)
- screenclear();
- else
- screen_start(); /* don't know where cursor is now */
-
- if (starting != NO_SCREEN) {
- maketitle();
- changed_line_abv_curs();
- invalidate_botline();
-
- /*
- * 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 ScreenLines[] is correct!
- */
- if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM
- || exmode_active) {
- screenalloc(false);
- repeat_message();
- } else {
- if (curwin->w_p_scb)
- do_check_scrollbind(TRUE);
- if (State & CMDLINE) {
- update_screen(NOT_VALID);
- redrawcmdline();
- } else {
- update_topline();
- if (pum_visible()) {
- redraw_later(NOT_VALID);
- ins_compl_show_pum(); /* This includes the redraw. */
- } else
- update_screen(NOT_VALID);
- if (redrawing())
- setcursor();
- }
- }
- cursor_on(); /* redrawing may have switched it off */
- }
- out_flush();
- --busy;
-}
-
-/*
* Set the terminal to TMODE_RAW (for Normal mode) or TMODE_COOK (for external
* commands and Ex mode).
*/