diff options
author | Jakob Schnitzer <mail@jakobschnitzer.de> | 2017-03-24 20:21:05 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-27 13:43:20 +0200 |
commit | 7bc37ffb22a84668bba5b2e3589c4c05ad43f7d0 (patch) | |
tree | 5934e78d1ad70956550df31298f571f9ff451890 /src/nvim/terminal.c | |
parent | 2b1398c31ea9ab9f4aaa40188f24d7e76a519e2d (diff) | |
download | rneovim-7bc37ffb22a84668bba5b2e3589c4c05ad43f7d0.tar.gz rneovim-7bc37ffb22a84668bba5b2e3589c4c05ad43f7d0.tar.bz2 rneovim-7bc37ffb22a84668bba5b2e3589c4c05ad43f7d0.zip |
terminal: global 'scrollback' #6352
Make the 'scrollback' option work like most other buffer-local options:
- `:set scrollback=x` sets the global and local value
- `:setglobal scrollback=x` sets only the global default
- new terminal buffers inherit the global
Normal buffers are still always -1, and :setlocal there is an error.
Closes #6337
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 87ee8f410f..dc418e25fa 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -85,8 +85,6 @@ typedef struct terminal_state { # include "terminal.c.generated.h" #endif -#define SB_MAX 100000 // Maximum 'scrollback' value. - // Delay for refreshing the terminal buffer after receiving updates from // libvterm. Improves performance when receiving large bursts of data. #define REFRESH_DELAY 10 @@ -231,10 +229,10 @@ Terminal *terminal_open(TerminalOptions opts) set_option_value((uint8_t *)"buftype", 0, (uint8_t *)"terminal", OPT_LOCAL); // Default settings for terminal buffers - curbuf->b_p_ma = false; // 'nomodifiable' - curbuf->b_p_ul = -1; // 'undolevels' - curbuf->b_p_scbk = 1000; // 'scrollback' - curbuf->b_p_tw = 0; // 'textwidth' + curbuf->b_p_ma = false; // 'nomodifiable' + curbuf->b_p_ul = -1; // 'undolevels' + curbuf->b_p_scbk = p_scbk; // 'scrollback' + curbuf->b_p_tw = 0; // 'textwidth' set_option_value((uint8_t *)"wrap", false, NULL, OPT_LOCAL); set_option_value((uint8_t *)"number", false, NULL, OPT_LOCAL); set_option_value((uint8_t *)"relativenumber", false, NULL, OPT_LOCAL); @@ -248,7 +246,8 @@ Terminal *terminal_open(TerminalOptions opts) apply_autocmds(EVENT_TERMOPEN, NULL, NULL, false, curbuf); // Configure the scrollback buffer. - rv->sb_size = curbuf->b_p_scbk < 0 ? SB_MAX : (size_t)curbuf->b_p_scbk;; + rv->sb_size = curbuf->b_p_scbk < 0 + ? SB_MAX : (size_t)MAX(1, curbuf->b_p_scbk); rv->sb_buffer = xmalloc(sizeof(ScrollbackLine *) * rv->sb_size); if (!true_color) { |