edit: color builtin specials correctly

This commit is contained in:
Qi Xiao 2016-01-26 17:35:43 +01:00
parent 9096d71704
commit 18b6e705c9

View File

@ -25,13 +25,23 @@ func colorFormHead(n parse.Node, ed *Editor) string {
}
func goodFormHead(head string, ed *Editor) bool {
if eval.DontSearch(head) {
if isBuiltinSpecial[head] {
return true
} else if eval.DontSearch(head) {
return eval.IsExecutable(head)
} else {
return ed.evaler.Global()["fn-"+head] != nil || ed.isExternal[head]
}
}
var isBuiltinSpecial = map[string]bool{}
func init() {
for _, name := range eval.BuiltinSpecialNames {
isBuiltinSpecial[name] = true
}
}
func colorVariable(n parse.Node, ed *Editor) string {
pn, ok := n.(*parse.Primary)
if !ok {