diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-19 03:48:20 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-02-26 11:29:02 +0100 |
commit | fedb8443d58af82f7603164395ff253b94c913ae (patch) | |
tree | 81d71e8d779926db2954e2970c237759e242625e /src/nvim/terminal.c | |
parent | 7ea81fe443369382b3ec8c9cfb5a80bcbcbe40bd (diff) | |
download | rneovim-fedb8443d58af82f7603164395ff253b94c913ae.tar.gz rneovim-fedb8443d58af82f7603164395ff253b94c913ae.tar.bz2 rneovim-fedb8443d58af82f7603164395ff253b94c913ae.zip |
terminal: Allow undo and 'modifiable'.
Partial step towards #2637. Will crash if *all* lines are deleted.
Closes #2607
References #5431
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 02500a407c..e56b5da183 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -237,12 +237,16 @@ Terminal *terminal_open(TerminalOptions opts) rv->invalid_end = opts.height; refresh_screen(rv, curbuf); set_option_value((uint8_t *)"buftype", 0, (uint8_t *)"terminal", OPT_LOCAL); + // some sane settings for terminal buffers + curbuf->b_p_ma = false; // 'nomodifiable' + curbuf->b_p_ul = -1; // disable undo 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); buf_set_term_title(curbuf, (char *)curbuf->b_ffname); RESET_BINDING(curwin); + // Apply TermOpen autocmds so the user can configure the terminal apply_autocmds(EVENT_TERMOPEN, NULL, NULL, false, curbuf); @@ -958,7 +962,7 @@ static void refresh_terminal(Terminal *term) buf_T *buf = handle_get_buffer(term->buf_handle); bool valid = true; if (!buf || !(valid = buf_valid(buf))) { - // destroyed by `close_buffer`. Dont do anything else + // Destroyed by `close_buffer`. Do not do anything else. if (!valid) { term->buf_handle = 0; } @@ -1039,7 +1043,7 @@ static void refresh_scrollback(Terminal *term, buf_T *buf) } } -// Refresh the screen(visible part of the buffer when the terminal is +// Refresh the screen (visible part of the buffer when the terminal is // focused) of a invalidated terminal static void refresh_screen(Terminal *term, buf_T *buf) { |