mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
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
This commit is contained in:

committed by
Justin M. Keyes

parent
2b1398c31e
commit
7bc37ffb22
@@ -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) {
|
||||
|
Reference in New Issue
Block a user