diff options
| author | Felipe Morales <hel.sheep@gmail.com> | 2015-07-20 21:30:42 -0300 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2015-07-21 23:54:01 -0400 |
| commit | a95a5ba8398193cfe0bd3e198a013447769b64ff (patch) | |
| tree | 2fe1c97a6d51bde8015d4e226ead28f099a3787d /src/nvim/tui | |
| parent | 5732340c203572715f3ef68d573f68a38447132c (diff) | |
| download | rneovim-a95a5ba8398193cfe0bd3e198a013447769b64ff.tar.gz rneovim-a95a5ba8398193cfe0bd3e198a013447769b64ff.tar.bz2 rneovim-a95a5ba8398193cfe0bd3e198a013447769b64ff.zip | |
options,tui: don't hardcode default terminal size
also, include some checks.
Diffstat (limited to 'src/nvim/tui')
| -rw-r--r-- | src/nvim/tui/tui.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index ae9e70e2e0..a1f56d2695 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1,6 +1,7 @@ #include <assert.h> #include <stdbool.h> #include <stdio.h> +#include <limits.h> #include <uv.h> #include <unibilium.h> @@ -648,7 +649,9 @@ static void update_size(UI *ui) int width = 0, height = 0; // 1 - look for non-default 'columns' and 'lines' options during startup - if (starting && (Columns != 80 || Rows != 24)) { + if (starting != 0 && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) { + assert(Columns >= INT_MIN && Columns <= INT_MAX); + assert(Rows >= INT_MIN && Rows <= INT_MAX); width = (int)Columns; height = (int)Rows; goto end; @@ -675,9 +678,9 @@ static void update_size(UI *ui) end: if (width <= 0 || height <= 0) { - // use a default of 80x24 - width = 80; - height = 24; + // use the defaults + width = DFLT_COLS; + height = DFLT_ROWS; } ui->width = width; |