mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
Merge #12230 'fix :terminal flicker with scrolloff'
This commit is contained in:
commit
fdd328d568
@ -50,6 +50,13 @@ mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys
|
|||||||
except <C-\><C-N> are sent to the underlying program. Use <C-\><C-N> to return
|
except <C-\><C-N> are sent to the underlying program. Use <C-\><C-N> to return
|
||||||
to normal-mode. |CTRL-\_CTRL-N|
|
to normal-mode. |CTRL-\_CTRL-N|
|
||||||
|
|
||||||
|
Terminal-mode forces these local options:
|
||||||
|
|
||||||
|
'nocursorline'
|
||||||
|
'nocursorcolumn'
|
||||||
|
'scrolloff' = 0
|
||||||
|
'sidescrolloff' = 0
|
||||||
|
|
||||||
Terminal-mode has its own |:tnoremap| namespace for mappings, this can be used
|
Terminal-mode has its own |:tnoremap| namespace for mappings, this can be used
|
||||||
to automate any terminal interaction.
|
to automate any terminal interaction.
|
||||||
|
|
||||||
|
@ -7453,6 +7453,10 @@ dict_T *get_winbuf_options(const int bufopt)
|
|||||||
/// global value when appropriate.
|
/// global value when appropriate.
|
||||||
long get_scrolloff_value(void)
|
long get_scrolloff_value(void)
|
||||||
{
|
{
|
||||||
|
// Disallow scrolloff in terminal-mode. #11915
|
||||||
|
if (State & TERM_FOCUS) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return curwin->w_p_so < 0 ? p_so : curwin->w_p_so;
|
return curwin->w_p_so < 0 ? p_so : curwin->w_p_so;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7462,4 +7466,3 @@ long get_sidescrolloff_value(void)
|
|||||||
{
|
{
|
||||||
return curwin->w_p_siso < 0 ? p_siso : curwin->w_p_siso;
|
return curwin->w_p_siso < 0 ? p_siso : curwin->w_p_siso;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,12 +343,16 @@ void terminal_enter(void)
|
|||||||
RedrawingDisabled = false;
|
RedrawingDisabled = false;
|
||||||
|
|
||||||
// Disable these options in terminal-mode. They are nonsense because cursor is
|
// Disable these options in terminal-mode. They are nonsense because cursor is
|
||||||
// placed at end of buffer to "follow" output.
|
// placed at end of buffer to "follow" output. #11072
|
||||||
win_T *save_curwin = curwin;
|
win_T *save_curwin = curwin;
|
||||||
int save_w_p_cul = curwin->w_p_cul;
|
int save_w_p_cul = curwin->w_p_cul;
|
||||||
int save_w_p_cuc = curwin->w_p_cuc;
|
int save_w_p_cuc = curwin->w_p_cuc;
|
||||||
|
long save_w_p_so = curwin->w_p_so;
|
||||||
|
long save_w_p_siso = curwin->w_p_siso;
|
||||||
curwin->w_p_cul = false;
|
curwin->w_p_cul = false;
|
||||||
curwin->w_p_cuc = false;
|
curwin->w_p_cuc = false;
|
||||||
|
curwin->w_p_so = 0;
|
||||||
|
curwin->w_p_siso = 0;
|
||||||
|
|
||||||
adjust_topline(s->term, buf, 0); // scroll to end
|
adjust_topline(s->term, buf, 0); // scroll to end
|
||||||
// erase the unfocused cursor
|
// erase the unfocused cursor
|
||||||
@ -370,6 +374,8 @@ void terminal_enter(void)
|
|||||||
if (save_curwin == curwin) { // save_curwin may be invalid (window closed)!
|
if (save_curwin == curwin) { // save_curwin may be invalid (window closed)!
|
||||||
curwin->w_p_cul = save_w_p_cul;
|
curwin->w_p_cul = save_w_p_cul;
|
||||||
curwin->w_p_cuc = save_w_p_cuc;
|
curwin->w_p_cuc = save_w_p_cuc;
|
||||||
|
curwin->w_p_so = save_w_p_so;
|
||||||
|
curwin->w_p_siso = save_w_p_siso;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the unfocused cursor
|
// draw the unfocused cursor
|
||||||
|
@ -17,6 +17,18 @@ describe(':terminal buffer', function()
|
|||||||
screen = thelpers.screen_setup()
|
screen = thelpers.screen_setup()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('terminal-mode forces various options', function()
|
||||||
|
feed([[<C-\><C-N>]])
|
||||||
|
command('setlocal cursorline cursorcolumn scrolloff=4 sidescrolloff=7')
|
||||||
|
eq({ 1, 1, 4, 7 }, eval('[&l:cursorline, &l:cursorcolumn, &l:scrolloff, &l:sidescrolloff]'))
|
||||||
|
eq('n', eval('mode()'))
|
||||||
|
|
||||||
|
-- Enter terminal-mode ("insert" mode in :terminal).
|
||||||
|
feed('i')
|
||||||
|
eq('t', eval('mode()'))
|
||||||
|
eq({ 0, 0, 0, 0 }, eval('[&l:cursorline, &l:cursorcolumn, &l:scrolloff, &l:sidescrolloff]'))
|
||||||
|
end)
|
||||||
|
|
||||||
describe('when a new file is edited', function()
|
describe('when a new file is edited', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>')
|
feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>')
|
||||||
|
Loading…
Reference in New Issue
Block a user