diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2021-04-13 12:13:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 12:13:44 +0200 |
commit | ef3f05c43267142aaf92f451d5da21f7c2ac638f (patch) | |
tree | 238b01ba76fe2b8ec85eb220fd2d11956bae83d7 | |
parent | 4a36ec6da029269a8bac3aa0a25fa43ad4b988b2 (diff) | |
download | rneovim-ef3f05c43267142aaf92f451d5da21f7c2ac638f.tar.gz rneovim-ef3f05c43267142aaf92f451d5da21f7c2ac638f.tar.bz2 rneovim-ef3f05c43267142aaf92f451d5da21f7c2ac638f.zip |
tutor: force one sign per line (#14352)
The only thing setting signs in the tutor buffer (buftype=nofile), should be
tutor.vim itself.
Instead of endlessly piling up new signs per line, just unplace any sign on the
line before placing a new one.
Closes https://github.com/neovim/neovim/issues/13808
Closes https://github.com/neovim/neovim/pull/13809
-rw-r--r-- | runtime/autoload/tutor.vim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 6afe64de84..abf5c5e2c8 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -104,6 +104,10 @@ function! tutor#CheckLine(line) if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect') let bufn = bufnr('%') let ctext = getline(a:line) + let signs = sign_getplaced('.', {'lnum': a:line})[0].signs + if !empty(signs) + call sign_unplace('', {'id': signs[0].id}) + endif if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)] exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn else |