From e772cfcc55878f82b5ab1358a10dcdca6c326e08 Mon Sep 17 00:00:00 2001 From: oni-link Date: Mon, 28 Apr 2014 19:52:05 +0200 Subject: vim-patch:7.4.241 Problem: The string returned by submatch() does not distinguish between a NL from a line break and a NL that stands for a NUL character. Solution: Add a second argument to return a list. (ZyX) https://code.google.com/p/vim/source/detail?r=a63d0cd691dc925283815d17d62f4e948d723a59 --- src/testdir/test79.in | Bin 2971 -> 3381 bytes src/testdir/test79.ok | Bin 439 -> 574 bytes src/testdir/test80.in | 2 ++ src/testdir/test80.ok | 3 +++ 4 files changed, 5 insertions(+) (limited to 'src/testdir') diff --git a/src/testdir/test79.in b/src/testdir/test79.in index c6108097d9..8278bd8000 100644 Binary files a/src/testdir/test79.in and b/src/testdir/test79.in differ diff --git a/src/testdir/test79.ok b/src/testdir/test79.ok index 8d2ead67ed..e22eee0b71 100644 Binary files a/src/testdir/test79.ok and b/src/testdir/test79.ok differ diff --git a/src/testdir/test80.in b/src/testdir/test80.in index c62fdc02b2..406fb6dac7 100644 --- a/src/testdir/test80.in +++ b/src/testdir/test80.in @@ -117,6 +117,7 @@ STARTTEST :set cpo& :$put =\"\n\nTEST_5:\" :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)', '') +:$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '') /^TEST_6 ENDTEST @@ -142,6 +143,7 @@ STARTTEST :$put =\"\n\nTEST_7:\" :$put =substitute('A A', 'A.', '\=submatch(0)', '') :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '') +:$put =substitute(\"B\nB\", 'B.', '\=string(submatch(0, 1))', '') :$put =substitute('-bb', '\zeb', 'a', 'g') :$put =substitute('-bb', '\ze', 'c', 'g') /^TEST_8 diff --git a/src/testdir/test80.ok b/src/testdir/test80.ok index 2b79d377a7..b42f604a07 100644 --- a/src/testdir/test80.ok +++ b/src/testdir/test80.ok @@ -90,6 +90,7 @@ l TEST_5: A123456789987654321 +[['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], ['2'], ['1']] TEST_6: @@ -103,6 +104,8 @@ TEST_7: A A B B +['B +']B -abab c-cbcbc -- cgit