fix(tutor): failing to get buf name #20933

Error detected while processing function tutor#TutorCmd[38]..BufReadPost Autocommands for "*":
    Error executing lua callback: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: Error ex
    ecuting lua: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: Vim(let):E158: Invalid bu
    ffer name: .
    stack traceback:
            [C]: in function 'nvim_cmd'
            ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: in function <...llar/neovim/HE
    AD-cc5b736/share/nvim/runtime/filetype.lua:21>
            [C]: in function 'nvim_buf_call'
            ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE
    AD-cc5b736/share/nvim/runtime/filetype.lua:10>
    stack traceback:
            [C]: in function 'nvim_buf_call'
            ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE
    AD-cc5b736/share/nvim/runtime/filetype.lua:10>


Closes https://github.com/neovim/neovim/issues/20920
This commit is contained in:
erw7 2022-11-07 12:18:30 +09:00 committed by GitHub
parent 9f125371e0
commit 10fbda508c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ 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
let signs = sign_getplaced(bufn, {'lnum': a:line})[0].signs
if !empty(signs)
call sign_unplace('', {'id': signs[0].id})
endif