🐛 Fix an issue in the script title retrieval from the first comment once more

This commit is contained in:
M. Mert Yildiran 2023-03-08 01:04:20 +03:00
parent 28fa6e494f
commit de7f598001
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461

View File

@ -31,17 +31,18 @@ func ReadScriptFile(path string) (script *Script, err error) {
} }
var title string var title string
var titleIsSet bool
code := content code := content
var idx0 file.Idx var idx0 file.Idx
for node, comments := range program.Comments { for node, comments := range program.Comments {
if (idx0 > 0 && node.Idx0() > idx0) || len(comments) == 0 { if (titleIsSet && node.Idx0() > idx0) || len(comments) == 0 {
continue continue
} }
idx0 = node.Idx0()
idx0 = node.Idx0()
title = comments[0].Text title = comments[0].Text
break titleIsSet = true
} }
script = &Script{ script = &Script{