diff options
author | Marco Hinz <mh.codebro+github@gmail.com> | 2019-02-04 02:53:23 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-02-04 02:53:23 +0100 |
commit | 91688b488310ae45ea5874df8729e7dfe554c0bc (patch) | |
tree | 01b240279dd6369adeb782a73902f9ecab9516e6 /src/nvim/option.c | |
parent | 70f6939fd4b5e0f03dc606eedae13ef28fc0f9dd (diff) | |
download | rneovim-91688b488310ae45ea5874df8729e7dfe554c0bc.tar.gz rneovim-91688b488310ae45ea5874df8729e7dfe554c0bc.tar.bz2 rneovim-91688b488310ae45ea5874df8729e7dfe554c0bc.zip |
options: set 'scrollback' to -1 by default #9563
Makes the 'scrollback' option more consistent (same default for all buffers) and future-proof.
- Default to -1 for all buffers, but treat it as an implementation detail.
- Document range of 1 - 100_000.
- New terminal buffer by default sets scrollback=10_000 if the global default is -1.
- Existing terminal buffer: On entering terminal-mode or on refresh, if the user explicitly did `:set[local] scbk=-1`, the local value goes to 100_000 (max). (This is undocumented on purpose. Users should work with explicit values in the range of 1-100_000.)
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index c57e6649bb..3914e020b1 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -4240,8 +4240,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, } else if (pp == &curbuf->b_p_channel || pp == &p_channel) { errmsg = e_invarg; } else if (pp == &curbuf->b_p_scbk || pp == &p_scbk) { - if (value < -1 || value > SB_MAX - || (value != -1 && opt_flags == OPT_LOCAL && !curbuf->terminal)) { + if (value < -1 || value > SB_MAX) { errmsg = e_invarg; } } else if (pp == &curbuf->b_p_sw || pp == &p_sw) { @@ -4435,11 +4434,6 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp; } - if (pp == &curbuf->b_p_scbk && !curbuf->terminal) { - // Normal buffer: reset local 'scrollback' after updating the global value. - curbuf->b_p_scbk = -1; - } - options[opt_idx].flags |= P_WAS_SET; // Don't do this while starting up, failure or recursively. @@ -5862,7 +5856,7 @@ void buf_copy_options(buf_T *buf, int flags) buf->b_p_ai = p_ai; buf->b_p_ai_nopaste = p_ai_nopaste; buf->b_p_sw = p_sw; - buf->b_p_scbk = -1; + buf->b_p_scbk = p_scbk; buf->b_p_tw = p_tw; buf->b_p_tw_nopaste = p_tw_nopaste; buf->b_p_tw_nobin = p_tw_nobin; |