mirror of
https://github.com/antonmedv/fx.git
synced 2024-08-17 14:10:46 +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 {
|
||||
quoted := string(at.key)
|
||||
unquoted, err := strconv.Unquote(quoted)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if identifier.MatchString(unquoted) {
|
||||
if err == nil && identifier.MatchString(unquoted) {
|
||||
path = "." + unquoted + path
|
||||
} else {
|
||||
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 {
|
||||
quoted := string(it.key)
|
||||
unquoted, err := strconv.Unquote(quoted)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if identifier.MatchString(unquoted) {
|
||||
if err == nil && identifier.MatchString(unquoted) {
|
||||
path = prefix + "." + unquoted
|
||||
} else {
|
||||
path = prefix + "[" + quoted + "]"
|
||||
@ -218,11 +215,12 @@ func (n *node) children() ([]string, []*node) {
|
||||
|
||||
for it != nil && it != n.end {
|
||||
if it.key != nil {
|
||||
unquoted, err := strconv.Unquote(string(it.key))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
key := string(it.key)
|
||||
unquoted, err := strconv.Unquote(key)
|
||||
if err == nil {
|
||||
key = unquoted
|
||||
}
|
||||
paths = append(paths, unquoted)
|
||||
paths = append(paths, key)
|
||||
nodes = append(nodes, it)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user