aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-02-21 01:52:16 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-02-26 11:57:52 +0100
commit300eca3d301e407adadc017e71502d20a4b207e8 (patch)
tree890ff867ffa56e4a0a773b6a3101f1b9117ba6c4 /src/nvim/option.c
parentfedb8443d58af82f7603164395ff253b94c913ae (diff)
downloadrneovim-300eca3d301e407adadc017e71502d20a4b207e8.tar.gz
rneovim-300eca3d301e407adadc017e71502d20a4b207e8.tar.bz2
rneovim-300eca3d301e407adadc017e71502d20a4b207e8.zip
options: 'scrollback'
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c50
1 files changed, 28 insertions, 22 deletions
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;