Skip checking `files` if no filename was provided to `syntax.get`
This commit is contained in:
parent
cfcd8af373
commit
2767ac3718
|
@ -49,7 +49,7 @@ function Doc:reset_syntax()
|
|||
path = core.project_dir .. PATHSEP .. self.filename
|
||||
end
|
||||
if path then path = common.normalize_path(path) end
|
||||
local syn = syntax.get(path or "", header)
|
||||
local syn = syntax.get(path, header)
|
||||
if self.syntax ~= syn then
|
||||
self.syntax = syn
|
||||
self.highlighter:soft_reset()
|
||||
|
|
|
@ -44,7 +44,7 @@ local function find(string, field)
|
|||
end
|
||||
|
||||
function syntax.get(filename, header)
|
||||
return find(filename, "files")
|
||||
return (filename and find(filename, "files"))
|
||||
or (header and find(header, "headers"))
|
||||
or plain_text_syntax
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue