Skip to content

Commit ef3f05c

Browse files
authored
tutor: force one sign per line (neovim#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 neovim#13808 Closes neovim#13809
1 parent 4a36ec6 commit ef3f05c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

runtime/autoload/tutor.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ function! tutor#CheckLine(line)
104104
if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
105105
let bufn = bufnr('%')
106106
let ctext = getline(a:line)
107+
let signs = sign_getplaced('.', {'lnum': a:line})[0].signs
108+
if !empty(signs)
109+
call sign_unplace('', {'id': signs[0].id})
110+
endif
107111
if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)]
108112
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn
109113
else

0 commit comments

Comments
 (0)