mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
6048e95f33
commit
5732340c20
@ -646,12 +646,20 @@ static void update_size(UI *ui)
|
|||||||
{
|
{
|
||||||
TUIData *data = ui->data;
|
TUIData *data = ui->data;
|
||||||
int width = 0, height = 0;
|
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)) {
|
if (!uv_tty_get_winsize(&data->output_handle, &width, &height)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2 - use $LINES/$COLUMNS if available
|
// 3 - use $LINES/$COLUMNS if available
|
||||||
const char *val;
|
const char *val;
|
||||||
int advance;
|
int advance;
|
||||||
if ((val = os_getenv("LINES"))
|
if ((val = os_getenv("LINES"))
|
||||||
@ -661,7 +669,7 @@ static void update_size(UI *ui)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3- read from terminfo if available
|
// 4 - read from terminfo if available
|
||||||
height = unibi_get_num(data->ut, unibi_lines);
|
height = unibi_get_num(data->ut, unibi_lines);
|
||||||
width = unibi_get_num(data->ut, unibi_columns);
|
width = unibi_get_num(data->ut, unibi_columns);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user