options: 'scrollback'

This commit is contained in:
Justin M. Keyes 2017-02-21 01:52:16 +01:00
parent fedb8443d5
commit 300eca3d30
6 changed files with 43 additions and 24 deletions

View File

@ -98,8 +98,7 @@ Mouse input is also fully supported, and has the following behavior:
Terminal buffers can be customized through the following global/buffer-local Terminal buffers can be customized through the following global/buffer-local
variables (set via the |TermOpen| autocmd): variables (set via the |TermOpen| autocmd):
- `{g,b}:terminal_scrollback_buffer_size`: Scrollback buffer size, between 1 - 'scrollback' option: Scrollback lines (output history) limit.
and 100000 inclusive. The default is 1000.
- `{g,b}:terminal_color_$NUM`: The terminal color palette, where `$NUM` is the - `{g,b}:terminal_color_$NUM`: The terminal color palette, where `$NUM` is the
color index, between 0 and 255 inclusive. This setting only affects UIs with color index, between 0 and 255 inclusive. This setting only affects UIs with
RGB capabilities; for normal terminals the color index is simply forwarded. RGB capabilities; for normal terminals the color index is simply forwarded.

View File

@ -4949,6 +4949,10 @@ A jump table for the options with a short description can be found at |Q_op|.
be used as the new value for 'scroll'. Reset to half the window be used as the new value for 'scroll'. Reset to half the window
height with ":set scroll=0". height with ":set scroll=0".
*'scrollback'* *'scbk'* *'noscrollback'* *'noscbk'*
'scrollback' 'scbk' boolean (default: 1000)
global or local to buffer |global-local|
*'scrollbind'* *'scb'* *'noscrollbind'* *'noscb'* *'scrollbind'* *'scb'* *'noscrollbind'* *'noscb'*
'scrollbind' 'scb' boolean (default off) 'scrollbind' 'scb' boolean (default off)
local to window local to window

View File

@ -651,6 +651,7 @@ struct file_buffer {
char_u *b_p_qe; ///< 'quoteescape' char_u *b_p_qe; ///< 'quoteescape'
int b_p_ro; ///< 'readonly' int b_p_ro; ///< 'readonly'
long b_p_sw; ///< 'shiftwidth' long b_p_sw; ///< 'shiftwidth'
long b_p_scbk; ///< 'scrollback'
int b_p_si; ///< 'smartindent' int b_p_si; ///< 'smartindent'
long b_p_sts; ///< 'softtabstop' long b_p_sts; ///< 'softtabstop'
long b_p_sts_nopaste; ///< b_p_sts saved for paste mode long b_p_sts_nopaste; ///< b_p_sts saved for paste mode

View File

@ -1,24 +1,18 @@
/* // User-settable options. Checklist for adding a new option:
* Code to handle user-settable options. This is all pretty much table- // - Put it in options.lua
* driven. Checklist for adding a new option: // - For a global option: Add a variable for it in option_defs.h.
* - Put it in the options array below (copy an existing entry). // - For a buffer or window local option:
* - For a global option: Add a variable for it in option_defs.h. // - Add a BV_XX or WV_XX entry to option_defs.h
* - For a buffer or window local option: // - Add a variable to the window or buffer struct in buffer_defs.h.
* - Add a PV_XX entry to the enum below. // - For a window option, add some code to copy_winopt().
* - Add a variable to the window or buffer struct in buffer_defs.h. // - For a buffer option, add some code to buf_copy_options().
* - For a window option, add some code to copy_winopt(). // - For a buffer string option, add code to check_buf_options().
* - For a buffer option, add some code to buf_copy_options(). // - If it's a numeric option, add any necessary bounds checks to do_set().
* - For a buffer string option, add code to check_buf_options(). // - If it's a list of flags, add some code in do_set(), search for WW_ALL.
* - If it's a numeric option, add any necessary bounds checks to do_set(). // - When adding an option with expansion (P_EXPAND), but with a different
* - If it's a list of flags, add some code in do_set(), search for WW_ALL. // default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
* - When adding an option with expansion (P_EXPAND), but with a different // - Add documentation! doc/options.txt, and any other related places.
* default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. // - Add an entry in runtime/optwin.vim.
* - Add documentation! One line in doc/help.txt, full description in
* options.txt, and any other related places.
* - Add an entry in runtime/optwin.vim.
* When making changes:
* - Adjust the help for the option in doc/option.txt.
*/
#define IN_OPTION_C #define IN_OPTION_C
#include <assert.h> #include <assert.h>
@ -161,6 +155,7 @@ static long p_ts;
static long p_tw; static long p_tw;
static int p_udf; static int p_udf;
static long p_wm; static long p_wm;
static long p_scbk;
static char_u *p_keymap; static char_u *p_keymap;
/* Saved values for when 'bin' is set. */ /* Saved values for when 'bin' is set. */
@ -3999,7 +3994,16 @@ set_num_option (
/* /*
* Number options that need some action when changed * Number options that need some action when changed
*/ */
if (pp == &p_wh || pp == &p_hh) { if (pp == &p_scbk) {
// 'scrollback'
if (p_scbk < 1) {
errmsg = e_invarg;
p_scbk = 0;
} else if (p_scbk > 100000) {
errmsg = e_invarg;
p_scbk = 100000;
}
} else if (pp == &p_wh || pp == &p_hh) {
if (p_wh < 1) { if (p_wh < 1) {
errmsg = e_positive; errmsg = e_positive;
p_wh = 1; p_wh = 1;
@ -5426,6 +5430,7 @@ static char_u *get_varp(vimoption_T *p)
case PV_PI: return (char_u *)&(curbuf->b_p_pi); case PV_PI: return (char_u *)&(curbuf->b_p_pi);
case PV_QE: return (char_u *)&(curbuf->b_p_qe); case PV_QE: return (char_u *)&(curbuf->b_p_qe);
case PV_RO: return (char_u *)&(curbuf->b_p_ro); case PV_RO: return (char_u *)&(curbuf->b_p_ro);
case PV_SCBK: return (char_u *)&(curbuf->b_p_scbk);
case PV_SI: return (char_u *)&(curbuf->b_p_si); case PV_SI: return (char_u *)&(curbuf->b_p_si);
case PV_STS: return (char_u *)&(curbuf->b_p_sts); case PV_STS: return (char_u *)&(curbuf->b_p_sts);
case PV_SUA: return (char_u *)&(curbuf->b_p_sua); case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
@ -5636,6 +5641,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_ai = p_ai; buf->b_p_ai = p_ai;
buf->b_p_ai_nopaste = p_ai_nopaste; buf->b_p_ai_nopaste = p_ai_nopaste;
buf->b_p_sw = p_sw; buf->b_p_sw = p_sw;
buf->b_p_scbk = p_scbk;
buf->b_p_tw = p_tw; buf->b_p_tw = p_tw;
buf->b_p_tw_nopaste = p_tw_nopaste; buf->b_p_tw_nopaste = p_tw_nopaste;
buf->b_p_tw_nobin = p_tw_nobin; buf->b_p_tw_nobin = p_tw_nobin;

View File

@ -739,6 +739,7 @@ enum {
, BV_PI , BV_PI
, BV_QE , BV_QE
, BV_RO , BV_RO
, BV_SCBK
, BV_SI , BV_SI
, BV_SMC , BV_SMC
, BV_SYN , BV_SYN

View File

@ -1912,6 +1912,14 @@ return {
pv_name='p_scroll', pv_name='p_scroll',
defaults={if_true={vi=12}} defaults={if_true={vi=12}}
}, },
{
full_name='scrollback', abbreviation='scbk',
type='number', scope={'buffer'},
vi_def=true,
varname='p_scbk',
redraw={'current_buffer'},
defaults={if_true={vi=1000}}
},
{ {
full_name='scrollbind', abbreviation='scb', full_name='scrollbind', abbreviation='scb',
type='bool', scope={'window'}, type='bool', scope={'window'},