From fe1216f875f4f627a2cd96ab55e9534c578c2d64 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Thu, 28 Mar 2024 16:01:09 +0100 Subject: [PATCH] Fixes #302 --- internal/jsonx/node.go | 4 ++++ main.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/internal/jsonx/node.go b/internal/jsonx/node.go index 0d0a881..dec9957 100644 --- a/internal/jsonx/node.go +++ b/internal/jsonx/node.go @@ -97,6 +97,10 @@ func (n *Node) Parent() *Node { return parent } +func (n *Node) IsWrap() bool { + return n.Value == nil && n.Chunk != nil +} + func (n *Node) IsCollapsed() bool { return n.Collapsed != nil } diff --git a/main.go b/main.go index 0783b71..287ff21 100644 --- a/main.go +++ b/main.go @@ -1014,6 +1014,9 @@ func (m *model) cursorKey() string { if at == nil { return "" } + if at.IsWrap() { + at = at.Parent() + } if at.Key != nil { var v string _ = json.Unmarshal(at.Key, &v)