Mercurial > vim
diff src/edit.c @ 10696:689e88afdd11 v8.0.0238
patch 8.0.0238: bracketed paste does not disable autoindent
commit https://github.com/vim/vim/commit/9e817c8a31232eda57963215eb16ee5b1ceefa7b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 25 21:36:17 2017 +0100
patch 8.0.0238: bracketed paste does not disable autoindent
Problem: When using bracketed paste autoindent causes indent to be
increased.
Solution: Disable 'ai' and set 'paste' temporarily. (Ken Takata)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 25 Jan 2017 21:45:04 +0100 |
parents | 83a36d655a74 |
children | 319bafc99ee8 |
line wrap: on
line diff
--- a/src/edit.c +++ b/src/edit.c @@ -9463,12 +9463,17 @@ bracketed_paste(paste_mode_T mode, int d char_u *end = find_termcode((char_u *)"PE"); int ret_char = -1; int save_allow_keys = allow_keys; + int save_paste = p_paste; + int save_ai = curbuf->b_p_ai; /* If the end code is too long we can't detect it, read everything. */ if (STRLEN(end) >= NUMBUFLEN) end = NULL; ++no_mapping; allow_keys = 0; + p_paste = TRUE; + curbuf->b_p_ai = FALSE; + for (;;) { /* When the end is not defined read everything. */ @@ -9534,8 +9539,11 @@ bracketed_paste(paste_mode_T mode, int d } idx = 0; } + --no_mapping; allow_keys = save_allow_keys; + p_paste = save_paste; + curbuf->b_p_ai = save_ai; return ret_char; }