summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-13 14:58:37 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-13 14:58:37 +0200
commit55b0fb7001ae42a58c10ad93a9157113f77a43d2 (patch)
tree88e88d90fd7c089174f40b46d889ca4b99f5d6df
parent2c330432cfb12181c61d698b5459bfd73d2610df (diff)
patch 8.2.0568: the man filetype plugin overwrites the unnamed registerv8.2.0568
Problem: The man filetype plugin overwrites the unnamed register. Solution: Use the black hole register. (Jason Franklin)
-rw-r--r--runtime/ftplugin/man.vim8
-rw-r--r--src/testdir/test_man.vim20
-rw-r--r--src/version.c2
3 files changed, 26 insertions, 4 deletions
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index 44efd4eb65..f627035eb2 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: man
" Maintainer: SungHyun Nam <goweol@gmail.com>
-" Last Change: 2020 Apr 6
+" Last Change: 2020 Apr 13
" To make the ":Man" command available before editing a manual page, source
" this script from your startup vimrc file.
@@ -188,7 +188,7 @@ func <SID>GetPage(cmdmods, ...)
setl buftype=nofile noswapfile
setl fdc=0 ma nofen nonu nornu
- silent exec "norm! 1GdG"
+ %delete _
let unsetwidth = 0
if empty($MANWIDTH)
let $MANWIDTH = winwidth(0)
@@ -213,10 +213,10 @@ func <SID>GetPage(cmdmods, ...)
endif
" Remove blank lines from top and bottom.
while line('$') > 1 && getline(1) =~ '^\s*$'
- silent keepj norm! ggdd
+ 1delete _
endwhile
while line('$') > 1 && getline('$') =~ '^\s*$'
- silent keepj norm! Gdd
+ $delete _
endwhile
1
setl ft=man nomod
diff --git a/src/testdir/test_man.vim b/src/testdir/test_man.vim
index 9de8cb474a..083b1aefc6 100644
--- a/src/testdir/test_man.vim
+++ b/src/testdir/test_man.vim
@@ -1,3 +1,5 @@
+" Test specifically for the Man filetype plugin.
+
runtime ftplugin/man.vim
func Test_g_ft_man_open_mode()
@@ -111,3 +113,21 @@ func Test_local_options()
%bw!
set foldcolumn& number&
endfunc
+
+" Check that the unnamed register is not overwritten.
+func Test_keep_unnamed_register()
+ %bw!
+
+ let @" = '---'
+
+ let wincnt = winnr('$')
+ Man vim
+ if wincnt == winnr('$')
+ " Vim manual page cannot be found.
+ return
+ endif
+
+ call assert_equal('---', @")
+
+ %bw!
+endfunc
diff --git a/src/version.c b/src/version.c
index d4250e598d..5659e92fca 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 568,
+/**/
567,
/**/
566,