To: vim_dev@googlegroups.com Subject: Patch 8.0.0238 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0238 Problem: When using bracketed paste autoindent causes indent to be increased. Solution: Disable 'ai' and set 'paste' temporarily. (Ken Takata) Files: src/edit.c, src/testdir/test_paste.vim *** ../vim-8.0.0237/src/edit.c 2017-01-24 19:08:10.934489594 +0100 --- src/edit.c 2017-01-25 21:32:16.244037908 +0100 *************** *** 9463,9474 **** --- 9463,9479 ---- 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,9541 **** --- 9539,9549 ---- } idx = 0; } + --no_mapping; allow_keys = save_allow_keys; + p_paste = save_paste; + curbuf->b_p_ai = save_ai; return ret_char; } *** ../vim-8.0.0237/src/testdir/test_paste.vim 2017-01-24 19:18:10.386436951 +0100 --- src/testdir/test_paste.vim 2017-01-25 21:33:38.555490257 +0100 *************** *** 35,40 **** --- 35,50 ---- call assert_equal('bar donfoo', getline(3)) call assert_equal('bar doneeb', getline(4)) call assert_equal('c', getline(5)) + + set ai et tw=10 + call setline(1, ['a', ' b', 'c']) + 2 + call feedkeys("A\[200~foo\ bar bar bar\[201~\", 'xt') + call assert_equal(' bfoo', getline(2)) + call assert_equal(' bar bar bar', getline(3)) + call assert_equal('c', getline(4)) + + set ai& et& tw=0 bwipe! endfunc *** ../vim-8.0.0237/src/version.c 2017-01-24 21:18:15.986024183 +0100 --- src/version.c 2017-01-25 21:35:39.002688840 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 238, /**/ -- WOMAN: King of the who? ARTHUR: The Britons. WOMAN: Who are the Britons? ARTHUR: Well, we all are. we're all Britons and I am your king. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///