From 7e646bbd6233d24096ac3be818a55afa7b07ee0a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 12 Aug 2022 00:06:25 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=81=A2=E5=A4=8D=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E4=BD=8D=E7=BD=AE=E6=97=B6=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=9D=97=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=20Fix=20https://github.com/siyuan-note/siyuan/issues/5618?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/file.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/model/file.go b/kernel/model/file.go index 27e1782e0..b782d475d 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -551,7 +551,7 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size var nodes []*ast.Node - // 如果同时存在 startID 和 endID,则只加载 startID 和 endID 之间的块 + // 如果同时存在 startID 和 endID,则只加载 startID 和 endID 之间的块 [startID, endID] if "" != startID && "" != endID { nodes, eof = loadNodesByStartEnd(tree, startID, endID) if 1 > len(nodes) { @@ -715,17 +715,16 @@ func loadNodesByStartEnd(tree *parse.Tree, startID, endID string) (nodes []*ast. } nodes = append(nodes, node) for n := node.Next; nil != n; n = n.Next { + nodes = append(nodes, n) + if n.ID == endID { - next := n.Next - if nil == next { + if next := n.Next; nil == next { eof = true } else { eof = util2.IsDocIAL(n.Tokens) || util2.IsDocIAL(next.Tokens) } break } - - nodes = append(nodes, n) } return }