aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-10-28 18:02:21 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-10-28 18:02:21 +0200
commit8c732f7274145805be817c481e313059bce9f037 (patch)
tree6b16f4cbda3088746846570ea1f3b9be29b475e5 /src
parentda13d9a30cf7a5428649a24f8761ae1d5dbc1f02 (diff)
parentbcf266de46b054b564727d5d31e4421ba09f5704 (diff)
downloadrneovim-8c732f7274145805be817c481e313059bce9f037.tar.gz
rneovim-8c732f7274145805be817c481e313059bce9f037.tar.bz2
rneovim-8c732f7274145805be817c481e313059bce9f037.zip
Merge #7440 "terminal: adjust for 'number'"
closes #5310
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/eval.c5
-rw-r--r--src/nvim/screen.c18
-rw-r--r--src/nvim/window.c8
4 files changed, 22 insertions, 11 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index fc5bb90973..9d42fbc1b3 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1466,7 +1466,7 @@ void enter_buffer(buf_T *buf)
if (buf->terminal) {
terminal_resize(buf->terminal,
- (uint16_t)curwin->w_width,
+ (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
(uint16_t)curwin->w_height);
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index aab777955c..ef2f671f36 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -16723,9 +16723,10 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
+ uint16_t term_width = MAX(0, curwin->w_width - win_col_off(curwin));
TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit,
true, false, false, cwd);
- data->proc.pty.width = curwin->w_width;
+ data->proc.pty.width = term_width;
data->proc.pty.height = curwin->w_height;
data->proc.pty.term_name = xstrdup("xterm-256color");
if (!common_job_start(data, rettv)) {
@@ -16733,7 +16734,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
TerminalOptions topts;
topts.data = data;
- topts.width = curwin->w_width;
+ topts.width = term_width;
topts.height = curwin->w_height;
topts.write_cb = term_write;
topts.resize_cb = term_resize;
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index f5730cf70a..38ecd88ec0 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -692,12 +692,18 @@ static void win_update(win_T *wp)
if (wp->w_nrwidth != i) {
type = NOT_VALID;
wp->w_nrwidth = i;
- } else if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0) {
- /*
- * When there are both inserted/deleted lines and specific lines to be
- * redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
- * everything (only happens when redrawing is off for while).
- */
+
+ if (buf->terminal) {
+ terminal_resize(buf->terminal,
+ (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
+ (uint16_t)curwin->w_height);
+ }
+ } else if (buf->b_mod_set
+ && buf->b_mod_xlines != 0
+ && wp->w_redraw_top != 0) {
+ // When there are both inserted/deleted lines and specific lines to be
+ // redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
+ // everything (only happens when redrawing is off for while).
type = NOT_VALID;
} else {
/*
diff --git a/src/nvim/window.c b/src/nvim/window.c
index c2d0a9b3b1..2d64409a1c 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3747,7 +3747,9 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
do_autochdir();
if (curbuf->terminal) {
- terminal_resize(curbuf->terminal, curwin->w_width, curwin->w_height);
+ terminal_resize(curbuf->terminal,
+ (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
+ (uint16_t)curwin->w_height);
}
}
@@ -4946,7 +4948,9 @@ 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, wp->w_width, 0);
+ terminal_resize(wp->w_buffer->terminal,
+ (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
+ 0);
}
}
}