aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-11-13 02:06:32 +0100
committerGitHub <noreply@github.com>2017-11-13 02:06:32 +0100
commite6beb60da517b6d7d7461687bf91f87d097b9563 (patch)
tree82619e74c1c5c2ce5c55c9c2d860fee95dd03575 /src
parent20c672a4604bc400229c52795a8488cd034ed1b4 (diff)
downloadrneovim-e6beb60da517b6d7d7461687bf91f87d097b9563.tar.gz
rneovim-e6beb60da517b6d7d7461687bf91f87d097b9563.tar.bz2
rneovim-e6beb60da517b6d7d7461687bf91f87d097b9563.zip
:terminal : fix crash on resize (#7547)
closes #7538 Fix wrong window references from #7440 Remove some eager resizing. Still mostly doesn't address #4997.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c7
-rw-r--r--src/nvim/screen.c4
-rw-r--r--src/nvim/window.c18
3 files changed, 4 insertions, 25 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index f874268910..766003a021 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -64,7 +64,6 @@
#include "nvim/spell.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
-#include "nvim/terminal.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/version.h"
@@ -1464,12 +1463,6 @@ void enter_buffer(buf_T *buf)
/* mark cursor position as being invalid */
curwin->w_valid = 0;
- if (buf->terminal) {
- terminal_resize(buf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
- }
-
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) { /* need to load the file */
/* If there is no filetype, allow for detecting one. Esp. useful for
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 41e900eb4c..ed96e98d32 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -696,8 +696,8 @@ static void win_update(win_T *wp)
if (buf->terminal) {
terminal_resize(buf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
+ (uint16_t)(MAX(0, wp->w_width - win_col_off(wp))),
+ (uint16_t)wp->w_height);
}
} else if (buf->b_mod_set
&& buf->b_mod_xlines != 0
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2d64409a1c..4e4eb297aa 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1846,12 +1846,6 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
shell_new_rows();
}
- if (term) {
- // When a window containing a terminal buffer is closed, recalculate its
- // size
- terminal_resize(term, 0, 0);
- }
-
// Since goto_tabpage_tp above did not trigger *Enter autocommands, do
// that now.
apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, curbuf);
@@ -3745,12 +3739,6 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
/* Change directories when the 'acd' option is set. */
do_autochdir();
-
- if (curbuf->terminal) {
- terminal_resize(curbuf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
- }
}
@@ -4930,9 +4918,7 @@ void scroll_to_fraction(win_T *wp, int prev_height)
}
}
-/*
- * Set the width of a window.
- */
+/// Set the width of a window.
void win_new_width(win_T *wp, int width)
{
wp->w_width = width;
@@ -4949,7 +4935,7 @@ void win_new_width(win_T *wp, int width)
if (wp->w_buffer->terminal) {
if (wp->w_height != 0) {
terminal_resize(wp->w_buffer->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
+ (uint16_t)(MAX(0, wp->w_width - win_col_off(wp))),
0);
}
}