aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Morales <hel.sheep@gmail.com>2015-07-18 20:37:10 -0300
committerJustin M. Keyes <justinkz@gmail.com>2015-07-21 23:52:09 -0400
commit5732340c203572715f3ef68d573f68a38447132c (patch)
treedd9d4ce3e560ca783d6889af16b235e6d0945944
parent6048e95f33161420f9d863a2ce5ccf9464df2dba (diff)
downloadrneovim-5732340c203572715f3ef68d573f68a38447132c.tar.gz
rneovim-5732340c203572715f3ef68d573f68a38447132c.tar.bz2
rneovim-5732340c203572715f3ef68d573f68a38447132c.zip
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.
-rw-r--r--src/nvim/tui/tui.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index c8565a1e5a..ae9e70e2e0 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -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);