Mercurial > vim
comparison src/testdir/test_substitute.vim @ 16716:5a541d459ef7 v8.1.1360
patch 8.1.1360: buffer left 'nomodifiable' after :substitute
commit https://github.com/vim/vim/commit/80341bcd89764d96f87859a3aac8bc00aad1d762
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 20 20:34:51 2019 +0200
patch 8.1.1360: buffer left 'nomodifiable' after :substitute
Problem: Buffer left 'nomodifiable' after :substitute. (Ingo Karkat)
Solution: Save the value of 'modifiable' earlier' (Christian Brabandt,
closes #4403)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 May 2019 20:45:06 +0200 |
parents | 6ea3f93b4428 |
children | f084f846442a |
comparison
equal
deleted
inserted
replaced
16715:2cb98b7ef466 | 16716:5a541d459ef7 |
---|---|
609 | 609 |
610 enew! | 610 enew! |
611 set titlestring& | 611 set titlestring& |
612 endfunc | 612 endfunc |
613 | 613 |
614 func Test_sub_cmd_9() | |
615 new | |
616 let input = ['1 aaa', '2 aaa', '3 aaa'] | |
617 call setline(1, input) | |
618 func Foo() | |
619 return submatch(0) | |
620 endfunc | |
621 %s/aaa/\=Foo()/gn | |
622 call assert_equal(input, getline(1, '$')) | |
623 call assert_equal(1, &modifiable) | |
624 | |
625 delfunc Foo | |
626 bw! | |
627 endfunc | |
628 | |
614 func Test_nocatch_sub_failure_handling() | 629 func Test_nocatch_sub_failure_handling() |
615 " normal error results in all replacements | 630 " normal error results in all replacements |
616 func! Foo() | 631 func Foo() |
617 foobar | 632 foobar |
618 endfunc | 633 endfunc |
619 new | 634 new |
620 call setline(1, ['1 aaa', '2 aaa', '3 aaa']) | 635 call setline(1, ['1 aaa', '2 aaa', '3 aaa']) |
621 %s/aaa/\=Foo()/g | 636 %s/aaa/\=Foo()/g |
647 let error_caught = 1 | 662 let error_caught = 1 |
648 endtry | 663 endtry |
649 call assert_equal(1, error_caught) | 664 call assert_equal(1, error_caught) |
650 call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3)) | 665 call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3)) |
651 | 666 |
667 delfunc Foo | |
652 bwipe! | 668 bwipe! |
653 endfunc | 669 endfunc |
654 | 670 |
655 " Test ":s/pat/sub/" with different ~s in sub. | 671 " Test ":s/pat/sub/" with different ~s in sub. |
656 func Test_replace_with_tilde() | 672 func Test_replace_with_tilde() |