summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUbaldo Tiberi <ubaldo.tiberi@google.com>2024-06-19 19:50:32 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-19 19:50:32 +0200
commit46f2823807741ac91c51cf36ddabf293db26ab41 (patch)
treeddb19c283536ddf88cf58b65f766a118339815f0 /src
parentaeca7176f3b7bdc2d698938062f6cad802fea783 (diff)
patch 9.1.0501: too complicated mapping restore in termdebugv9.1.0501
Problem: too complicated mapping restore in termdebug Solution: simplify unmapping logic, add a few more tests (Ubaldo Tiberi) closes: #15046 Signed-off-by: Ubaldo Tiberi <ubaldo.tiberi@google.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_termdebug.vim34
-rw-r--r--src/version.c2
2 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_termdebug.vim b/src/testdir/test_termdebug.vim
index d3bf5f489c..d142a9f031 100644
--- a/src/testdir/test_termdebug.vim
+++ b/src/testdir/test_termdebug.vim
@@ -278,9 +278,20 @@ func Test_termdebug_mapping()
call assert_equal(':echom "K"<cr>', maparg('K', 'n', 0, 1).rhs)
%bw!
+
+ " -- Test that local-buffer mappings are restored in the correct buffers --
+ " local mappings for foo
+ file foo
nnoremap <buffer> K :echom "bK"<cr>
nnoremap <buffer> - :echom "b-"<cr>
nnoremap <buffer> + :echom "b+"<cr>
+
+ " no mappings for 'bar'
+ enew
+ file bar
+
+ " Start termdebug from foo
+ buffer foo
Termdebug
call WaitForAssert({-> assert_equal(3, winnr('$'))})
wincmd b
@@ -288,10 +299,33 @@ func Test_termdebug_mapping()
call assert_true(maparg('-', 'n', 0, 1).buffer)
call assert_true(maparg('+', 'n', 0, 1).buffer)
call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"<cr>')
+
+ Source
+ buffer bar
+ call assert_false(maparg('K', 'n', 0, 1)->empty())
+ call assert_false(maparg('-', 'n', 0, 1)->empty())
+ call assert_false(maparg('+', 'n', 0, 1)->empty())
+ call assert_true(maparg('K', 'n', 0, 1).buffer->empty())
+ call assert_true(maparg('-', 'n', 0, 1).buffer->empty())
+ call assert_true(maparg('+', 'n', 0, 1).buffer->empty())
wincmd t
quit!
redraw!
call WaitForAssert({-> assert_equal(1, winnr('$'))})
+
+ " Termdebug session ended. Buffer 'bar' shall have no mappings
+ call assert_true(bufname() ==# 'bar')
+ call assert_false(maparg('K', 'n', 0, 1)->empty())
+ call assert_false(maparg('-', 'n', 0, 1)->empty())
+ call assert_false(maparg('+', 'n', 0, 1)->empty())
+ call assert_true(maparg('K', 'n', 0, 1).buffer->empty())
+ call assert_true(maparg('-', 'n', 0, 1).buffer->empty())
+ call assert_true(maparg('+', 'n', 0, 1).buffer->empty())
+
+ " Buffer 'foo' shall have the same mapping as before running the termdebug
+ " session
+ buffer foo
+ call assert_true(bufname() ==# 'foo')
call assert_true(maparg('K', 'n', 0, 1).buffer)
call assert_true(maparg('-', 'n', 0, 1).buffer)
call assert_true(maparg('+', 'n', 0, 1).buffer)
diff --git a/src/version.c b/src/version.c
index 0e2e3ba469..2d65eb2af5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 501,
+/**/
500,
/**/
499,