aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Pyatkov <mrbiggfoot@gmail.com>2018-04-28 16:39:21 -0700
committerJustin M. Keyes <justinkz@gmail.com>2019-01-29 03:00:48 +0100
commit894f6bee54e80811f95b8767327d39ab277a4866 (patch)
tree2e68b87f74f971b6cd7d82dd3a35df95cd128fa4 /src
parent28f87c505d895df8d00a919f6324f5305f02166e (diff)
downloadrneovim-894f6bee54e80811f95b8767327d39ab277a4866.tar.gz
rneovim-894f6bee54e80811f95b8767327d39ab277a4866.tar.bz2
rneovim-894f6bee54e80811f95b8767327d39ab277a4866.zip
:terminal : set topline based on window height #8325
closes #8324 closes #8556
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/terminal.c4
2 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index b3977e0176..07d8ab2e0c 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -1063,7 +1063,7 @@ struct window_S {
int w_width; /* Width of window, excluding separation. */
int w_vsep_width; /* Number of separator columns (0 or 1). */
- // inner size of window, which can be overriden by external UI
+ // inner size of window, which can be overridden by external UI
int w_height_inner;
int w_width_inner;
// external UI request. If non-zero, the inner size will use this.
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 6516f46b2f..33050ac642 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1311,8 +1311,6 @@ static void redraw(bool restore_cursor)
static void adjust_topline(Terminal *term, buf_T *buf, long added)
{
- int height, width;
- vterm_get_size(term->vt, &height, &width);
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer == buf) {
linenr_T ml_end = buf->b_ml.ml_line_count;
@@ -1321,7 +1319,7 @@ static void adjust_topline(Terminal *term, buf_T *buf, long added)
if (following || (wp == curwin && is_focused(term))) {
// "Follow" the terminal output
wp->w_cursor.lnum = ml_end;
- set_topline(wp, MAX(wp->w_cursor.lnum - height + 1, 1));
+ set_topline(wp, MAX(wp->w_cursor.lnum - wp->w_height_inner + 1, 1));
} else {
// Ensure valid cursor for each window displaying this terminal.
wp->w_cursor.lnum = MIN(wp->w_cursor.lnum, ml_end);