mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
8c732f7274
@ -1466,7 +1466,7 @@ void enter_buffer(buf_T *buf)
|
|||||||
|
|
||||||
if (buf->terminal) {
|
if (buf->terminal) {
|
||||||
terminal_resize(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);
|
(uint16_t)curwin->w_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,
|
TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit,
|
||||||
true, false, false, cwd);
|
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.height = curwin->w_height;
|
||||||
data->proc.pty.term_name = xstrdup("xterm-256color");
|
data->proc.pty.term_name = xstrdup("xterm-256color");
|
||||||
if (!common_job_start(data, rettv)) {
|
if (!common_job_start(data, rettv)) {
|
||||||
@ -16733,7 +16734,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
}
|
}
|
||||||
TerminalOptions topts;
|
TerminalOptions topts;
|
||||||
topts.data = data;
|
topts.data = data;
|
||||||
topts.width = curwin->w_width;
|
topts.width = term_width;
|
||||||
topts.height = curwin->w_height;
|
topts.height = curwin->w_height;
|
||||||
topts.write_cb = term_write;
|
topts.write_cb = term_write;
|
||||||
topts.resize_cb = term_resize;
|
topts.resize_cb = term_resize;
|
||||||
|
@ -692,12 +692,18 @@ static void win_update(win_T *wp)
|
|||||||
if (wp->w_nrwidth != i) {
|
if (wp->w_nrwidth != i) {
|
||||||
type = NOT_VALID;
|
type = NOT_VALID;
|
||||||
wp->w_nrwidth = i;
|
wp->w_nrwidth = i;
|
||||||
} else if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0) {
|
|
||||||
/*
|
if (buf->terminal) {
|
||||||
* When there are both inserted/deleted lines and specific lines to be
|
terminal_resize(buf->terminal,
|
||||||
* redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
|
(uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
|
||||||
* everything (only happens when redrawing is off for while).
|
(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;
|
type = NOT_VALID;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
@ -3747,7 +3747,9 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
|
|||||||
do_autochdir();
|
do_autochdir();
|
||||||
|
|
||||||
if (curbuf->terminal) {
|
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_buffer->terminal) {
|
||||||
if (wp->w_height != 0) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,49 @@ describe('terminal window', function()
|
|||||||
screen = thelpers.screen_setup()
|
screen = thelpers.screen_setup()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('with colorcolumn set', function()
|
describe("with 'number'", function()
|
||||||
|
it('wraps text', function()
|
||||||
|
feed([[<C-\><C-N>]])
|
||||||
|
feed([[:set numberwidth=1 number<CR>i]])
|
||||||
|
screen:expect([[
|
||||||
|
{7:1 }tty ready |
|
||||||
|
{7:2 }rows: 6, cols: 48 |
|
||||||
|
{7:3 }{1: } |
|
||||||
|
{7:4 } |
|
||||||
|
{7:5 } |
|
||||||
|
{7:6 } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'})
|
||||||
|
screen:expect([[
|
||||||
|
{7:1 }tty ready |
|
||||||
|
{7:2 }rows: 6, cols: 48 |
|
||||||
|
{7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV|
|
||||||
|
{7:4 }WXYZ{1: } |
|
||||||
|
{7:5 } |
|
||||||
|
{7:6 } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- numberwidth=9
|
||||||
|
feed([[<C-\><C-N>]])
|
||||||
|
feed([[:set numberwidth=9 number<CR>i]])
|
||||||
|
thelpers.feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'})
|
||||||
|
screen:expect([[
|
||||||
|
{7: 1 }tty ready |
|
||||||
|
{7: 2 }rows: 6, cols: 48 |
|
||||||
|
{7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO|
|
||||||
|
{7: 4 }WXYZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJ|
|
||||||
|
{7: 5 }KLMNOPQRSTUVWXYZrows: 6, cols: 41 |
|
||||||
|
{7: 6 }{1: } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
describe("with 'colorcolumn'", function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
feed('<c-\\><c-n>')
|
feed([[<C-\><C-N>]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
tty ready |
|
tty ready |
|
||||||
{2:^ } |
|
{2:^ } |
|
||||||
@ -23,7 +63,7 @@ describe('terminal window', function()
|
|||||||
|
|
|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
feed(':set colorcolumn=20<cr>i')
|
feed(':set colorcolumn=20<CR>i')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('wont show the color column', function()
|
it('wont show the color column', function()
|
||||||
@ -41,7 +81,7 @@ describe('terminal window', function()
|
|||||||
|
|
||||||
describe('with fold set', function()
|
describe('with fold set', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
feed('<c-\\><c-n>:set foldenable foldmethod=manual<cr>i')
|
feed([[<C-\><C-N>:set foldenable foldmethod=manual<CR>i]])
|
||||||
thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''})
|
thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''})
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
tty ready |
|
tty ready |
|
||||||
@ -55,7 +95,7 @@ describe('terminal window', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('wont show any folds', function()
|
it('wont show any folds', function()
|
||||||
feed('<c-\\><c-n>ggvGzf')
|
feed([[<C-\><C-N>ggvGzf]])
|
||||||
wait()
|
wait()
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^tty ready |
|
^tty ready |
|
||||||
|
Loading…
Reference in New Issue
Block a user