tui: respect the 'co' and 'lines' options on startup

`nvim --cmd "set co=... lines="` didn't work as expected, and forced to
set those options on VimEnter or afterwards.
This commit is contained in:
Felipe Morales 2015-07-18 20:37:10 -03:00 committed by Justin M. Keyes
parent 6048e95f33
commit 5732340c20

View File

@ -646,12 +646,20 @@ static void update_size(UI *ui)
{
TUIData *data = ui->data;
int width = 0, height = 0;
// 1 - try from a system call(ioctl/TIOCGWINSZ on unix)
// 1 - look for non-default 'columns' and 'lines' options during startup
if (starting && (Columns != 80 || Rows != 24)) {
width = (int)Columns;
height = (int)Rows;
goto end;
}
// 2 - try from a system call(ioctl/TIOCGWINSZ on unix)
if (!uv_tty_get_winsize(&data->output_handle, &width, &height)) {
goto end;
}
// 2 - use $LINES/$COLUMNS if available
// 3 - use $LINES/$COLUMNS if available
const char *val;
int advance;
if ((val = os_getenv("LINES"))
@ -661,7 +669,7 @@ static void update_size(UI *ui)
goto end;
}
// 3- read from terminfo if available
// 4 - read from terminfo if available
height = unibi_get_num(data->ut, unibi_lines);
width = unibi_get_num(data->ut, unibi_columns);