From a3ec2b7753ed0c151142953d52efe4517fabb498 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 4 Oct 2022 12:06:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:bug:=20=E5=8F=8D=E9=93=BE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=87=BA=E7=8E=B0=E5=BC=82=E5=B8=B8=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=20Fix=20https://github.com/siyuan-note/insid?= =?UTF-8?q?er/issues/1083?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/backlink.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kernel/model/backlink.go b/kernel/model/backlink.go index 44e0649e3..92ea0f07f 100644 --- a/kernel/model/backlink.go +++ b/kernel/model/backlink.go @@ -254,13 +254,15 @@ func buildBacklink(refID string, refTree *parse.Tree, luteEngine *lute.Lute) (re c = n.FirstChild.Next } - for liFirstBlockSpan := c.FirstChild; nil != liFirstBlockSpan; liFirstBlockSpan = liFirstBlockSpan.Next { - if treenode.IsBlockRef(liFirstBlockSpan) { - continue - } - if "" != strings.TrimSpace(liFirstBlockSpan.Text()) { - expand = false - break + if c != n.LastChild { // 存在子列表 + for liFirstBlockSpan := c.FirstChild; nil != liFirstBlockSpan; liFirstBlockSpan = liFirstBlockSpan.Next { + if treenode.IsBlockRef(liFirstBlockSpan) { + continue + } + if "" != strings.TrimSpace(liFirstBlockSpan.Text()) { + expand = false + break + } } } From e59167912ea20e230ee1237752c95e2556fa9ee4 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 4 Oct 2022 12:09:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:art:=20=E4=BD=BF=E7=94=A8=E9=80=80?= =?UTF-8?q?=E6=A0=BC=E9=94=AE=E5=88=A0=E9=99=A4=E5=86=85=E5=AE=B9=E6=97=B6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A0=8F=E5=AE=9E=E6=97=B6=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=97=AA=E7=83=81=20https://github.com/siyua?= =?UTF-8?q?n-note/insider/issues/1082?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/transaction.go | 7 ------- kernel/util/websocket.go | 4 ---- 2 files changed, 11 deletions(-) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 70faf8abc..fad01e0da 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -997,8 +997,6 @@ func (tx *Transaction) begin() (err error) { func (tx *Transaction) commit() (err error) { for _, tree := range tx.trees { - go pushTreeStat(tree) - if err = writeJSONQueue(tree); nil != err { return } @@ -1009,11 +1007,6 @@ func (tx *Transaction) commit() (err error) { return } -func pushTreeStat(tree *parse.Tree) { - stat := treenode.StatTree(tree) - util.PushStatusBarCounter(stat) -} - func (tx *Transaction) rollback() { tx.trees, tx.nodes = nil, nil return diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go index 2d8c7db46..f63dc017d 100644 --- a/kernel/util/websocket.go +++ b/kernel/util/websocket.go @@ -159,10 +159,6 @@ type BlockStatResult struct { RefCount int `json:"refCount"` } -func PushStatusBarCounter(stat *BlockStatResult) { - BroadcastByType("main", "statusbarCounter", 0, "", stat) -} - func ContextPushMsg(context map[string]interface{}, msg string) { switch context[eventbus.CtxPushMsg].(int) { case eventbus.CtxPushMsgToProgress: From 63de0c79f91bd4a4791348e5eeac3d59af99266b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 4 Oct 2022 12:26:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:bug:=20=E5=BD=93=E5=9D=97=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E4=B8=8E=E6=89=80=E5=BC=95=E7=94=A8=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=BD=8D=E4=BA=8E=E5=90=8C=E4=B8=80=E4=B8=AA=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=9D=97=E5=BC=95=E7=94=A8=E4=B8=8E=E6=89=80?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=9A=84=E5=86=85=E5=AE=B9=E5=9D=97=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BA=A4=E6=8D=A2=E5=8A=9F=E8=83=BD=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20Fix=20https://github.com/siyuan-note/insider/issues/1085?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/block.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/model/block.go b/kernel/model/block.go index bcd12e97f..e9a10e230 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -106,7 +106,13 @@ func SwapBlockRef(refID, defID string, includeChildren bool) (err error) { if nil != err { return } - defNode := treenode.GetNodeInTree(defTree, defID) + sameTree := defTree.ID == refTree.ID + var defNode *ast.Node + if !sameTree { + defNode = treenode.GetNodeInTree(defTree, defID) + } else { + defNode = treenode.GetNodeInTree(refTree, defID) + } if nil == defNode { return } @@ -185,9 +191,11 @@ func SwapBlockRef(refID, defID string, includeChildren bool) (err error) { if err = writeJSONQueue(refTree); nil != err { return } - treenode.ReindexBlockTree(defTree) - if err = writeJSONQueue(defTree); nil != err { - return + if !sameTree { + treenode.ReindexBlockTree(defTree) + if err = writeJSONQueue(defTree); nil != err { + return + } } WaitForWritingFiles() util.ReloadUI()