mirror of
https://github.com/antonmedv/fx.git
synced 2024-09-11 18:27:10 +03:00
parent
0d636cc6b3
commit
0b6ab660a3
5
main.go
5
main.go
@ -732,10 +732,7 @@ func (m *model) cursorPath() string {
|
|||||||
if at.key != nil {
|
if at.key != nil {
|
||||||
quoted := string(at.key)
|
quoted := string(at.key)
|
||||||
unquoted, err := strconv.Unquote(quoted)
|
unquoted, err := strconv.Unquote(quoted)
|
||||||
if err != nil {
|
if err == nil && identifier.MatchString(unquoted) {
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if identifier.MatchString(unquoted) {
|
|
||||||
path = "." + unquoted + path
|
path = "." + unquoted + path
|
||||||
} else {
|
} else {
|
||||||
path = "[" + quoted + "]" + path
|
path = "[" + quoted + "]" + path
|
||||||
|
14
node.go
14
node.go
@ -177,10 +177,7 @@ func (n *node) paths(prefix string, paths *[]string, nodes *[]*node) {
|
|||||||
if it.key != nil {
|
if it.key != nil {
|
||||||
quoted := string(it.key)
|
quoted := string(it.key)
|
||||||
unquoted, err := strconv.Unquote(quoted)
|
unquoted, err := strconv.Unquote(quoted)
|
||||||
if err != nil {
|
if err == nil && identifier.MatchString(unquoted) {
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if identifier.MatchString(unquoted) {
|
|
||||||
path = prefix + "." + unquoted
|
path = prefix + "." + unquoted
|
||||||
} else {
|
} else {
|
||||||
path = prefix + "[" + quoted + "]"
|
path = prefix + "[" + quoted + "]"
|
||||||
@ -218,11 +215,12 @@ func (n *node) children() ([]string, []*node) {
|
|||||||
|
|
||||||
for it != nil && it != n.end {
|
for it != nil && it != n.end {
|
||||||
if it.key != nil {
|
if it.key != nil {
|
||||||
unquoted, err := strconv.Unquote(string(it.key))
|
key := string(it.key)
|
||||||
if err != nil {
|
unquoted, err := strconv.Unquote(key)
|
||||||
panic(err)
|
if err == nil {
|
||||||
|
key = unquoted
|
||||||
}
|
}
|
||||||
paths = append(paths, unquoted)
|
paths = append(paths, key)
|
||||||
nodes = append(nodes, it)
|
nodes = append(nodes, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user