aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/main.c10
-rw-r--r--src/nvim/option.c7
-rw-r--r--src/nvim/window.c11
3 files changed, 16 insertions, 12 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index ddb3fbdd65..673b177463 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -185,11 +185,11 @@ void early_init(mparm_T *paramp)
init_locale();
#endif
- // Allocate the first window and buffer.
- // Can't do anything without it, exit when it fails.
- if (!win_alloc_first()) {
- os_exit(0);
- }
+ // tabpage local options (p_ch) must be set before allocating first tabpage.
+ set_init_tablocal();
+
+ // Allocate the first tabpage, window and buffer.
+ win_alloc_first();
TIME_MSG("init first window");
alist_init(&global_alist); // Init the argument list to empty.
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 9d0ba6a478..4a93fddc1b 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -147,6 +147,13 @@ typedef enum {
# include "option.c.generated.h"
#endif
+void set_init_tablocal(void)
+{
+ // susy baka: cmdheight calls itself OPT_GLOBAL but is really tablocal!
+ int ch_idx = findoption("cmdheight");
+ p_ch = (long)options[ch_idx].def_val;
+}
+
/// Initialize the options, first part.
///
/// Called only once from main(), just after creating the first buffer.
diff --git a/src/nvim/window.c b/src/nvim/window.c
index c3806e10ff..c0edef7abc 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3865,13 +3865,12 @@ void close_others(int message, int forceit)
}
// Allocate the first window and put an empty buffer in it.
-// Called from main().
-//
-// Return FAIL when something goes wrong.
-int win_alloc_first(void)
+// Only called from main().
+void win_alloc_first(void)
{
if (win_alloc_firstwin(NULL) == FAIL) {
- return FAIL;
+ // allocating first buffer before any autocmds should not fail.
+ abort();
}
first_tabpage = alloc_tabpage();
@@ -3880,8 +3879,6 @@ int win_alloc_first(void)
curtab->tp_firstwin = firstwin;
curtab->tp_lastwin = lastwin;
curtab->tp_curwin = curwin;
-
- return OK;
}
// Init `aucmd_win`. This can only be done after the first window