diff options
| -rw-r--r-- | runtime/doc/nvim_terminal_emulator.txt | 3 | ||||
| -rw-r--r-- | runtime/doc/options.txt | 4 | ||||
| -rw-r--r-- | src/nvim/buffer_defs.h | 1 | ||||
| -rw-r--r-- | src/nvim/option.c | 50 | ||||
| -rw-r--r-- | src/nvim/option_defs.h | 1 | ||||
| -rw-r--r-- | src/nvim/options.lua | 8 | 
6 files changed, 43 insertions, 24 deletions
| diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 8f7dc0dbf0..f368e28911 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -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  variables (set via the |TermOpen| autocmd): -- `{g,b}:terminal_scrollback_buffer_size`: Scrollback buffer size, between 1 -  and 100000 inclusive. The default is 1000. +- 'scrollback' option: Scrollback lines (output history) limit.  - `{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    RGB capabilities; for normal terminals the color index is simply forwarded. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index cd257b7780..504363949b 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -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  	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'	boolean  (default off)  			local to window diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 154df0eff0..ccdab16ca1 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -651,6 +651,7 @@ struct file_buffer {    char_u *b_p_qe;               ///< 'quoteescape'    int b_p_ro;                   ///< 'readonly'    long b_p_sw;                  ///< 'shiftwidth' +  long b_p_scbk;                ///< 'scrollback'    int b_p_si;                   ///< 'smartindent'    long b_p_sts;                 ///< 'softtabstop'    long b_p_sts_nopaste;         ///< b_p_sts saved for paste mode diff --git a/src/nvim/option.c b/src/nvim/option.c index e697ab3f51..7d0a16b051 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1,24 +1,18 @@ -/* - * Code to handle user-settable options. This is all pretty much table- - * driven. Checklist for adding a new option: - * - Put it in the options array below (copy an existing entry). - * - For a global option: Add a variable for it in option_defs.h. - * - For a buffer or window local option: - *   - Add a PV_XX entry to the enum below. - *   - Add a variable to the window or buffer struct in buffer_defs.h. - *   - For a window option, add some code to copy_winopt(). - *   - For a buffer option, add some code to buf_copy_options(). - *   - For a buffer string option, add code to check_buf_options(). - * - If it's a numeric option, add any necessary bounds checks to do_set(). - * - If it's a list of flags, add some code in do_set(), search for WW_ALL. - * - When adding an option with expansion (P_EXPAND), but with a different - *   default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. - * - 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. - */ +// User-settable options. Checklist for adding a new option: +// - Put it in options.lua +// - For a global option: Add a variable for it in option_defs.h. +// - For a buffer or window local option: +//   - Add a BV_XX or WV_XX entry to option_defs.h +//   - Add a variable to the window or buffer struct in buffer_defs.h. +//   - For a window option, add some code to copy_winopt(). +//   - For a buffer option, add some code to buf_copy_options(). +//   - For a buffer string option, add code to check_buf_options(). +// - If it's a numeric option, add any necessary bounds checks to do_set(). +// - If it's a list of flags, add some code in do_set(), search for WW_ALL. +// - When adding an option with expansion (P_EXPAND), but with a different +//   default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. +// - Add documentation! doc/options.txt, and any other related places. +// - Add an entry in runtime/optwin.vim.  #define IN_OPTION_C  #include <assert.h> @@ -161,6 +155,7 @@ static long p_ts;  static long p_tw;  static int p_udf;  static long p_wm; +static long p_scbk;  static char_u   *p_keymap;  /* Saved values for when 'bin' is set. */ @@ -3999,7 +3994,16 @@ set_num_option (    /*     * 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) {        errmsg = e_positive;        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_QE:     return (char_u *)&(curbuf->b_p_qe);    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_STS:    return (char_u *)&(curbuf->b_p_sts);    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_nopaste = p_ai_nopaste;        buf->b_p_sw = p_sw; +      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; diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index d077f5f2f7..9c6393e014 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -739,6 +739,7 @@ enum {    , BV_PI    , BV_QE    , BV_RO +  , BV_SCBK    , BV_SI    , BV_SMC    , BV_SYN diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 4130e69858..3208979446 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1913,6 +1913,14 @@ return {        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',        type='bool', scope={'window'},        vi_def=true, | 
